Click here to Skip to main content
15,913,284 members
Home / Discussions / C#
   

C#

 
AnswerRe: What is Reason? (plz reply) Pin
Christian Graus21-Aug-07 19:59
protectorChristian Graus21-Aug-07 19:59 
QuestionHow to print datagidview with form control Pin
tech-progg21-Aug-07 17:14
tech-progg21-Aug-07 17:14 
AnswerRe: How to print datagidview with form control Pin
Syed Mujtaba Hassan21-Aug-07 18:55
Syed Mujtaba Hassan21-Aug-07 18:55 
QuestionsQL with C# update question Pin
falles0121-Aug-07 13:39
falles0121-Aug-07 13:39 
AnswerRe: sQL with C# update question Pin
Christian Graus21-Aug-07 13:41
protectorChristian Graus21-Aug-07 13:41 
GeneralRe: sQL with C# update question Pin
falles0121-Aug-07 13:47
falles0121-Aug-07 13:47 
GeneralRe: sQL with C# update question Pin
Christian Graus21-Aug-07 17:00
protectorChristian Graus21-Aug-07 17:00 
GeneralRe: sQL with C# update question Pin
Christian Graus21-Aug-07 17:19
protectorChristian Graus21-Aug-07 17:19 
string sql = "UPDATE employees SET Firstname = '" + employeeTextBox.Text + "' Where EmployeeID = '" + employeeID + "'";

I am assuming the textbox is on the second form, therefore that control is correct ? Also, employeeId is an int, why is it stored as a string in the database ? If it's not, then change to this:

string sql = "UPDATE employees SET Firstname = '" + employeeTextBox.Text + "' Where EmployeeID = " + employeeID;

Note, I made a typing error, and so I lost the name of the textbox, and just made something up, you may need to fix that, to make it all work. The brackets are superfluous in either case.

And again, this is open to injection attacks. That means, someone can enter an employee name which erases your entire database.

Is this an assignment, or is it paid work ? If it's an assignment, I apologise for being a bit harsh previously, but if you've been given this code and told to work on it, that sounds like a job task. And, if that's true, you need to make the code more secure ( an assignment obviously is not as important, at this stage of your learning curve )





Christian Graus - Microsoft MVP - C++

"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

GeneralRe: sQL with C# update question Pin
falles0122-Aug-07 13:16
falles0122-Aug-07 13:16 
GeneralRe: sQL with C# update question Pin
Christian Graus23-Aug-07 13:44
protectorChristian Graus23-Aug-07 13:44 
GeneralRe: sQL with C# update question Pin
falles0123-Aug-07 14:03
falles0123-Aug-07 14:03 
GeneralRe: sQL with C# update question Pin
Christian Graus23-Aug-07 16:55
protectorChristian Graus23-Aug-07 16:55 
GeneralRe: sQL with C# update question Pin
falles0122-Aug-07 13:18
falles0122-Aug-07 13:18 
GeneralRe: sQL with C# update question Pin
falles0121-Aug-07 13:58
falles0121-Aug-07 13:58 
GeneralRe: sQL with C# update question Pin
Christian Graus21-Aug-07 16:58
protectorChristian Graus21-Aug-07 16:58 
AnswerRe: sQL with C# update question Pin
Nouman Bhatti21-Aug-07 21:05
Nouman Bhatti21-Aug-07 21:05 
GeneralRe: sQL with C# update question Pin
Christian Graus21-Aug-07 21:51
protectorChristian Graus21-Aug-07 21:51 
QuestionCannot Update ColumnNames in Dataset......which is Directly populated by Excel Pin
T4AMD21-Aug-07 13:29
T4AMD21-Aug-07 13:29 
QuestionCapturing WebCams Pin
Demian Panello21-Aug-07 11:44
Demian Panello21-Aug-07 11:44 
QuestionProblem in deleting an image associated with a picturebox... Pin
aravinda77721-Aug-07 9:39
aravinda77721-Aug-07 9:39 
AnswerRe: Problem in deleting an image associated with a picturebox... Pin
Christian Graus21-Aug-07 11:14
protectorChristian Graus21-Aug-07 11:14 
GeneralRe: Problem in deleting an image associated with a picturebox... Pin
aravinda77721-Aug-07 19:52
aravinda77721-Aug-07 19:52 
QuestionDataGridView focus Pin
tthellebuyck21-Aug-07 8:40
tthellebuyck21-Aug-07 8:40 
AnswerRe: DataGridView focus Pin
Hessam Jalali21-Aug-07 9:29
Hessam Jalali21-Aug-07 9:29 
Questiondata conversion problem Pin
elwoofy21-Aug-07 7:31
elwoofy21-Aug-07 7:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.