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!....

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.