M
mspiezio
I'm trying to update or delete records using a gridview, but every time I try
(either on my own or copy from an example) , I get the error:
System.Data.SqlClient.SqlException: Must declare the scalar variable '@uid'.
my datasource commands are:
gridViewDataSource.SelectCommand = "SELECT [uid], [firstName], [lastName],
FROM [TestNames]";
gridViewDataSource.DeleteCommand = "DELETE FROM [TestNames] WHERE [uid] =
@uid";
gridViewDataSource.UpdateCommand = "UPDATE [TestNames] Set [firstName] =
@firstName, [lastName] = @lastName WHERE [uid] = @uid";
The update and delete commands do work if I leave off the WHERE statement,
but obviously that doesn't give me the desired result. If it try it with the
WHERE statement, I get the error.
(either on my own or copy from an example) , I get the error:
System.Data.SqlClient.SqlException: Must declare the scalar variable '@uid'.
my datasource commands are:
gridViewDataSource.SelectCommand = "SELECT [uid], [firstName], [lastName],
FROM [TestNames]";
gridViewDataSource.DeleteCommand = "DELETE FROM [TestNames] WHERE [uid] =
@uid";
gridViewDataSource.UpdateCommand = "UPDATE [TestNames] Set [firstName] =
@firstName, [lastName] = @lastName WHERE [uid] = @uid";
The update and delete commands do work if I leave off the WHERE statement,
but obviously that doesn't give me the desired result. If it try it with the
WHERE statement, I get the error.