G
GatorBait
Hi all,
I am having a problem with my data adapter update command. I have
generated the data adapter in the IDE and then I built a dataset. The
dataset can get changed in the program and I would like to update the
database. I tried to do so using the update method of the data
adapter, but the table is not getting updated. While debugging I made
sure that the dataset has the correct value prior to calling the update
method. I think the problem is in the CommandText of the UpdateCommand
property of the data adapter. I'm not really sure what all this (see
below) means, and I'm not really sure what is "supposed to go in the
CommandText. One of my fields is called Printed and that is the only
thing I want to update, based on the Letter_Id. Can someone please
help me do what I thought was a simple update to my db?
Thank you very much!!!
This is the code that VS created (I appologize for it being so
long!)....
UPDATE dbo.Letters
SET Old_Letter_ID = @Old_Letter_ID, Old_Client_ID =
@Old_Client_ID, Old_Policy_ID = @Old_Policy_ID, Client_ID = @Client_ID,
Policy_ID = @Policy_ID, Memo1 = @Memo1, Descriptions = @Descriptions,
DateSent = @DateSent, TimeSent = @TimeSent, LetterName = @LetterName,
Printed = @Printed, PrintAgain = @PrintAgain, UserName = @UserName,
Agency = @Agency, rowguid = @rowguid WHERE (Letter_ID =
@Original_Letter_ID) AND (Agency = @Original_Agency) AND (Client_ID =
@Original_Client_ID) AND (DateSent = @Original_DateSent OR
@Original_DateSent IS NULL AND DateSent IS NULL) AND (Descriptions =
@Original_Descriptions OR
@Original_Descriptions IS NULL AND Descriptions IS NULL) AND
(LetterName = @Original_LetterName OR @Original_LetterName IS NULL AND
LetterName IS NULL) AND (Memo1 = @Original_Memo1 OR
@Original_Memo1 IS NULL AND Memo1 IS NULL) AND (Old_Client_ID =
@Original_Old_Client_ID OR @Original_Old_Client_ID IS NULL AND
Old_Client_ID IS NULL) AND (Old_Letter_ID = @Original_Old_Letter_ID OR
@Original_Old_Letter_ID IS NULL AND Old_Letter_ID IS NULL) AND
(Old_Policy_ID = @Original_Old_Policy_ID OR @Original_Old_Policy_ID IS
NULL AND Old_Policy_ID IS NULL) AND (Policy_ID = @Original_Policy_ID OR
@Original_Policy_ID IS NULL AND Policy_ID IS NULL) AND (PrintAgain =
@Original_PrintAgain) AND (Printed = @Original_Printed) AND
(TimeSent = @Original_TimeSent OR @Original_TimeSent IS NULL AND
TimeSent IS NULL) AND (UserName = @Original_UserName OR
@Original_UserName IS NULL AND UserName IS NULL) AND (rowguid =
@Original_rowguid); SELECT Letter_ID, Old_Letter_ID, Old_Client_ID,
Old_Policy_ID, Client_ID, Policy_ID, Memo1, Descriptions, DateSent,
TimeSent, LetterName, Printed, PrintAgain, UserName, Agency, rowguid
FROM dbo.Letters WHERE (Letter_ID = @Letter_ID)
I am having a problem with my data adapter update command. I have
generated the data adapter in the IDE and then I built a dataset. The
dataset can get changed in the program and I would like to update the
database. I tried to do so using the update method of the data
adapter, but the table is not getting updated. While debugging I made
sure that the dataset has the correct value prior to calling the update
method. I think the problem is in the CommandText of the UpdateCommand
property of the data adapter. I'm not really sure what all this (see
below) means, and I'm not really sure what is "supposed to go in the
CommandText. One of my fields is called Printed and that is the only
thing I want to update, based on the Letter_Id. Can someone please
help me do what I thought was a simple update to my db?
Thank you very much!!!
This is the code that VS created (I appologize for it being so
long!)....
UPDATE dbo.Letters
SET Old_Letter_ID = @Old_Letter_ID, Old_Client_ID =
@Old_Client_ID, Old_Policy_ID = @Old_Policy_ID, Client_ID = @Client_ID,
Policy_ID = @Policy_ID, Memo1 = @Memo1, Descriptions = @Descriptions,
DateSent = @DateSent, TimeSent = @TimeSent, LetterName = @LetterName,
Printed = @Printed, PrintAgain = @PrintAgain, UserName = @UserName,
Agency = @Agency, rowguid = @rowguid WHERE (Letter_ID =
@Original_Letter_ID) AND (Agency = @Original_Agency) AND (Client_ID =
@Original_Client_ID) AND (DateSent = @Original_DateSent OR
@Original_DateSent IS NULL AND DateSent IS NULL) AND (Descriptions =
@Original_Descriptions OR
@Original_Descriptions IS NULL AND Descriptions IS NULL) AND
(LetterName = @Original_LetterName OR @Original_LetterName IS NULL AND
LetterName IS NULL) AND (Memo1 = @Original_Memo1 OR
@Original_Memo1 IS NULL AND Memo1 IS NULL) AND (Old_Client_ID =
@Original_Old_Client_ID OR @Original_Old_Client_ID IS NULL AND
Old_Client_ID IS NULL) AND (Old_Letter_ID = @Original_Old_Letter_ID OR
@Original_Old_Letter_ID IS NULL AND Old_Letter_ID IS NULL) AND
(Old_Policy_ID = @Original_Old_Policy_ID OR @Original_Old_Policy_ID IS
NULL AND Old_Policy_ID IS NULL) AND (Policy_ID = @Original_Policy_ID OR
@Original_Policy_ID IS NULL AND Policy_ID IS NULL) AND (PrintAgain =
@Original_PrintAgain) AND (Printed = @Original_Printed) AND
(TimeSent = @Original_TimeSent OR @Original_TimeSent IS NULL AND
TimeSent IS NULL) AND (UserName = @Original_UserName OR
@Original_UserName IS NULL AND UserName IS NULL) AND (rowguid =
@Original_rowguid); SELECT Letter_ID, Old_Letter_ID, Old_Client_ID,
Old_Policy_ID, Client_ID, Policy_ID, Memo1, Descriptions, DateSent,
TimeSent, LetterName, Printed, PrintAgain, UserName, Agency, rowguid
FROM dbo.Letters WHERE (Letter_ID = @Letter_ID)