Hi everyone,
I am getting a data from the user from a textbox and I want to add it to the SQL server but I don't want to use a stored procedure instead codes are on the *.aspx page.
My code is:
INSERT INTO Authors (Id, LName) values(UserName,@txtUserPass )
and error message is:
System.Data.SqlClient.SqlException: Must declare the variable '@txtUserName'
when I use this code with adding a string like below there is no problem
INSERT INTO Authors (Id, LName) values('User','pass' )
but I want to use variables.Is there anyway to do this directly without using stored procedures?
Thanks a lot
I am getting a data from the user from a textbox and I want to add it to the SQL server but I don't want to use a stored procedure instead codes are on the *.aspx page.
My code is:
INSERT INTO Authors (Id, LName) values(UserName,@txtUserPass )
and error message is:
System.Data.SqlClient.SqlException: Must declare the variable '@txtUserName'
when I use this code with adding a string like below there is no problem
INSERT INTO Authors (Id, LName) values('User','pass' )
but I want to use variables.Is there anyway to do this directly without using stored procedures?
Thanks a lot