Inserting data into a database

Jun 22 2004 5:27 PM
Hi, I am using the following code, can any one help me i am trying to solve this problem science 3 days. Urgent need please...... string cmdstr="INSERT INTO tblRegisteredUsers (UserID,TPwd,UserFName,UserLName) VALUES('"+UserId.Text+"', "+ " '"+Pwd.Text+"','"+FirstName.Text+"','"+LastName.Text+"')"; The data is not inserting into a table.....and giving the exception error that Index cant be empty. But When I am trying to insert data like this its working. string cmdstr="INSERT INTO tblRegisteredUsers (UserID,TPwd,UserFName,UserLName) VALUES ('aaa','aaa','aaa','aaa')"; Whats wrong with this....... I am not using any ASP code.....its just c# and ADO.net. Thanks a lot for hlep.

Answers (1)