P
Patrick
Hello
I try to do the following thing:
SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM test",new
SqlConnection(this.ConnectionString));
adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
SqlCommandBuilder cmdBuilder = new SqlCommandBuilder(adapter);
SqlCommand insertCommand= cmdBuilder.GetInsertCommand(true);
cmdBuilder.DataAdapter.InsertCommand = insertCommand;
insertCommand.CommandText =
insertCommand.CommandText.Replace("@mydbinteger", "33");
so far all works. I have a dataadpter with the new update
now I call
adapter.Update(new DataRow[] { dataRow });
so what happens is that the InsertCommand is changed to the original one. I
see everything is ok untill this line comes, then I tried to attach to the
RowUpdating event and saw, on that moment all has been changed to the
original insertcommand
has someone an idea what I'm doing wrong
Thanks
Patrick
I try to do the following thing:
SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM test",new
SqlConnection(this.ConnectionString));
adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
SqlCommandBuilder cmdBuilder = new SqlCommandBuilder(adapter);
SqlCommand insertCommand= cmdBuilder.GetInsertCommand(true);
cmdBuilder.DataAdapter.InsertCommand = insertCommand;
insertCommand.CommandText =
insertCommand.CommandText.Replace("@mydbinteger", "33");
so far all works. I have a dataadpter with the new update
now I call
adapter.Update(new DataRow[] { dataRow });
so what happens is that the InsertCommand is changed to the original one. I
see everything is ok untill this line comes, then I tried to attach to the
RowUpdating event and saw, on that moment all has been changed to the
original insertcommand
has someone an idea what I'm doing wrong
Thanks
Patrick