Yes, the reason that is is that Update never really hit the db b/c of hte
acceptchanges.
There's a lot wrong with your update code. No parameters have been added to
the parameters colleciton. That's the first problem. Basically, you add
them like
command.Parameters.Add()//there are a few different overloads that you can
look at.
Next you'll need to specify the columnmapping in the parameter declaration.
I'm going to include a sample, but it's sqlClient (very similar) but your
best bet is drag a OleDbDDataAdapter on your form (or in another project),
set your connection, add the table you want to query and let it generate the
logic for you . that will give you a really good idea of what's going on
(for many reasons I recommend this) Here's a sample, but you definitely
want to run through the wizard at least once and see (perhaps even copy and
paste the code directly once you generate it)
this.sqlUpdateCommand1.CommandText = @"UPDATE Employees SET EmplNum =
@EmplNum, LastName = @LastName, FirstName = @FirstName, BirthDate =
@BirthDate WHERE (EmplNum = @Original_EmplNum) AND (BirthDate =
@Original_BirthDate OR @Original_BirthDate IS NULL AND BirthDate IS NULL)
AND (FirstName = @Original_FirstName OR @Original_FirstName IS NULL AND
FirstName IS NULL) AND (LastName = @Original_LastName OR @Original_LastName
IS NULL AND LastName IS NULL); SELECT EmplNum, LastName, FirstName,
BirthDate FROM Employees WHERE (EmplNum = @EmplNum)";
this.sqlUpdateCommand1.Connection = this.sqlConnection2;
this.sqlUpdateCommand1.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@EmplNum", System.Data.SqlDbType.Int, 4,
"EmplNum"));
this.sqlUpdateCommand1.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@LastName",
System.Data.SqlDbType.NVarChar, 20, "LastName"));
this.sqlUpdateCommand1.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@FirstName",
System.Data.SqlDbType.NVarChar, 20, "FirstName"));
this.sqlUpdateCommand1.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@BirthDate",
System.Data.SqlDbType.DateTime, 4, "BirthDate"));