Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

my oleDb Delete commands are not working.

 

i have an oledbDataAdapter with insert, update and delete commands like so:

 

this.daRequests.InsertCommand = conn.CreateCommand();							this.daRequests.InsertCommand.CommandText = "insert into requests(patient_id,requests)" +
													"values(@patient_id,@requests)";
this.daRequests.InsertCommand.Parameters.Add("@patient_id",OleDbType.VarChar,50,"patient_id");
this.daRequests.InsertCommand.Parameters.Add("@requests",OleDbType.VarChar,120,"requests");

this.daRequests.UpdateCommand = conn.CreateCommand();
this.daRequests.UpdateCommand.CommandText = "update requests set requests = ? where patient_id =?";
this.daRequests.UpdateCommand.Parameters.Add("@requests",OleDbType.VarChar,120,"requests");
this.daRequests.UpdateCommand.Parameters.Add("@patient_id",OleDbType.VarChar,50,"patient_id");

this.daRequests.DeleteCommand = conn.CreateCommand();
this.daRequests.DeleteCommand.CommandText = "delete from requests where patient_id = @patient_id and requests = @requests";
this.daRequests.DeleteCommand.Parameters.Add("@patient_id",OleDbType.VarChar,50,"patient_id");
this.daRequests.DeleteCommand.Parameters.Add("@requests",OleDbType.VarChar,120,"requests");

the insert commands work fine. i dont really use the update ones as the table is mapped to a data grid so a row is either added or deleted, not edited. can anyone see a problem with the delete statement?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...