Multiple Queries in Dataset
Posted: Fri 08 May 2009 17:43
I have a typed dataset and I need to execute and update statement and then execute a SELCT statement with the same id so my dataset can get the ID of the record that was updated or inserted.
For SQL the query is as below:
@"UPDATE [dbo].[Testing] SET [Testing] = @Testing, [Testing1] = @Testing1, [Testing2] = @Testing2, [Testing3] = @Testing3 WHERE (([ID] = @Original_ID) AND ((@IsNull_Testing = 1 AND [Testing] IS NULL) OR ([Testing] = @Original_Testing)) AND ((@IsNull_Testing1 = 1 AND [Testing1] IS NULL) OR ([Testing1] = @Original_Testing1)) AND ((@IsNull_Testing2 = 1 AND [Testing2] IS NULL) OR ([Testing2] = @Original_Testing2)) AND ((@IsNull_Testing3 = 1 AND [Testing3] IS NULL) OR ([Testing3] = @Original_Testing3)));
SELECT ID, Testing, Testing1, Testing2, Testing3 FROM Testing WHERE (ID = @ID)";
I need to produce the same thing for a PostgreSQL database. This is my attempt at that and I get the error "cannot insert multiple commands into a prepared statement"
this._adapter.UpdateCommand.CommandText = @"UPDATE lanemanager.reservations SET type = :type, startdate = :startdate, enddate = :enddate, allday = :allday, subject = :subject, location = :location, description = :description, status = :status, label = :label,
resourceid = :resourceid, reminderinfo = :reminderinfo, recurrenceinfo = :recurrenceinfo, customfield1 = :customfield1 WHERE (uniqueid = :Original_uniqueid);
SELECT uniqueid, type, startdate, enddate, allday, subject, location, description, status, label, resourceid, reminderinfo, recurrenceinfo, customfield1 FROM lanemanager.reservations
WHERE uniqueid = :Original_uniqueid;";
Any help that you can give me on this would be most appreciated.
For SQL the query is as below:
@"UPDATE [dbo].[Testing] SET [Testing] = @Testing, [Testing1] = @Testing1, [Testing2] = @Testing2, [Testing3] = @Testing3 WHERE (([ID] = @Original_ID) AND ((@IsNull_Testing = 1 AND [Testing] IS NULL) OR ([Testing] = @Original_Testing)) AND ((@IsNull_Testing1 = 1 AND [Testing1] IS NULL) OR ([Testing1] = @Original_Testing1)) AND ((@IsNull_Testing2 = 1 AND [Testing2] IS NULL) OR ([Testing2] = @Original_Testing2)) AND ((@IsNull_Testing3 = 1 AND [Testing3] IS NULL) OR ([Testing3] = @Original_Testing3)));
SELECT ID, Testing, Testing1, Testing2, Testing3 FROM Testing WHERE (ID = @ID)";
I need to produce the same thing for a PostgreSQL database. This is my attempt at that and I get the error "cannot insert multiple commands into a prepared statement"
this._adapter.UpdateCommand.CommandText = @"UPDATE lanemanager.reservations SET type = :type, startdate = :startdate, enddate = :enddate, allday = :allday, subject = :subject, location = :location, description = :description, status = :status, label = :label,
resourceid = :resourceid, reminderinfo = :reminderinfo, recurrenceinfo = :recurrenceinfo, customfield1 = :customfield1 WHERE (uniqueid = :Original_uniqueid);
SELECT uniqueid, type, startdate, enddate, allday, subject, location, description, status, label, resourceid, reminderinfo, recurrenceinfo, customfield1 FROM lanemanager.reservations
WHERE uniqueid = :Original_uniqueid;";
Any help that you can give me on this would be most appreciated.