fguihen Posted January 3, 2006 Posted January 3, 2006 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? Quote
Administrators PlausiblyDamp Posted January 3, 2006 Administrators Posted January 3, 2006 What do you mean by not working, is it raising errors or just not deleting the records? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.