Go4Expert

Go4Expert (http://www.go4expert.com/)
-   ASP (http://www.go4expert.com/forums/asp/)
-   -   Sqldatasource updatecommand error (http://www.go4expert.com/forums/sqldatasource-updatecommand-error-t18553/)

Carlos 16Jul2009 00:18

Sqldatasource updatecommand error
 
Hi! please see this code it gives runtime error:Must declare the scalar variable "@LastName".


SqlDataSource datasource1 = new SqlDataSource();
datasource1.ConnectionString = WebConfigurationManager.ConnectionStrings["connectionstring1"].ConnectionString;


datasource1.UpdateCommand = "Update [Employees] Set [LastName]=@LastName, [FirstName]=@FirstName where [EmployeeID]=@EmployeeID";

datasource1.UpdateParameters.Add("@LastName", "James");
datasource1.UpdateParameters.Add("@FirstName", "Jimmy");
datasource1.UpdateParameters.Add("@EmployeeID",Tex tBox1.Text.ToString() );

datasource1.Update();


Please tell me where i am wrong???


All times are GMT +5.5. The time now is 03:27.