0

I have this Insert Statement code in C# window application....

String MyString = @"INSERT INTO tblUsers(userID, Name, Position) VALUES('a','b','c')";

how if I would like to give values from a textbox:

//Please correct this code because it is not working....

String MyString = @"INSERT INTO tblUsers(userID, Name, Position) VALUES('"txId"','"txtUser"','"txtPosition"')";

I need answer ASAP

THANK YOU for time!....

2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by JerryShaw
0

string MyString = string.format("INSERT INTO tblUsers(userID, Name, Position)
VALUES('{0}','{1}','{2}'", txId.Text, txtUser.Text, txtPosition.Text );

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.