G
Guest
I have the following statements that worked without a hitch on my laptop:
string sqlStr = "select * from table where id = @id";
SqlConnection conn = new SqlConnection(connStr);
SqlDataAdpapter sda = new SqlDataAdapter(sqlStr, conn);
sda.SelectCommand.Add(new SqlParameter("@id", SqlDbType.Int)).Value = val;
SqlCommandBuilder builder = new SqlCommandBuilder(sda);
DataTable dt = new DataTable();
sda.Fill(dt);
..... some update on dt ...
sda.Update(dt);
On a different machine, I got an error saying " Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information." The table already has primary key defined. There also doesn't seem to be a way to let the selectcommand return any key column information. Does anyone know what could be the cause of the problem? Many thanks!
string sqlStr = "select * from table where id = @id";
SqlConnection conn = new SqlConnection(connStr);
SqlDataAdpapter sda = new SqlDataAdapter(sqlStr, conn);
sda.SelectCommand.Add(new SqlParameter("@id", SqlDbType.Int)).Value = val;
SqlCommandBuilder builder = new SqlCommandBuilder(sda);
DataTable dt = new DataTable();
sda.Fill(dt);
..... some update on dt ...
sda.Update(dt);
On a different machine, I got an error saying " Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information." The table already has primary key defined. There also doesn't seem to be a way to let the selectcommand return any key column information. Does anyone know what could be the cause of the problem? Many thanks!