Subject | Problem with table update using IBO |
---|---|
Author | etish2000 |
Post date | 2004-04-01T22:35:55Z |
I have some information I want to allow a user to update in a table.
First I read the data from the table and populate a dialog with the
fields I want to allow as editable.
When the user clicks the Save button I have an update query that
gathers data from the fields and performs an update in the table.
This modified data is used as parameters in the SQL statement.
The problem is that all the fields but one seem to update just fine.
The one field gets the updated information from the dialog, but for
some reason that particular field is not updated in the database
table.
The code goes something like this ...
DaDataMod.qryUpdateUserInfo.ParamByName(`UserID').asInteger :=
UserInfo.UserID; // This is just a data type with current user info
DaDataMod.qryUpdateUserInfo.ParamByName(`FirstName').asString :=
txtFirstName.Text;
DaDataMod.qryUpdateUserInfo.ParamByName(`LastName').asString :=
txtLastName.Text;
DaDataMod.qryUpdateUserInfo.ParamByName(`EmailAddress').asString :=
txtEmail.Text;
DaDataMod.qryUpdateUserInfo.ExecSQL;
DaDataMod.qryUpdateUserInfo.IB_Transaction.CommitRetaining;
The qryUpdateUserInfo Query looks like this:
UPDATE "UserInfo" SET
"FirstName" = :FirstName,
"LastName" = :LastName,
"EmailAddress" = :EmailAddress
WHERE
"UserID" = :UserID
I have debugged this and can clearly see that ALL the fields have the
new data, but the Email field stubbornly refuses to take on a new
value. I have checked and in the database, the Email field is just a
VARCHAR(50).
I have tried to look at the SQL statement submitted (using:
DaDataMod.qryUpdateUserInfo.ServerSQL), but this is what I see in my
log file:
4:56:12 PM 4/1/2004 SaveAccountInfo: SQL=
UPDATE "UserInfo" SET
"FirstName" = ? /* FirstName */ ,
"LastName" = ? /* LastName */ ,
"EmailAddress" = ? /* EmailAddress */
WHERE
"UserID" = ? /* userid */
I have two questions:
1) Is there something better than ServerSQL to use to see that actual
SQL string submitted? I have tried SQL.Text, but that only show the
parameters before the substitution
2) Why would all the fields be updated except the EmailAdress field?
I have been `noodling' with this for the past 2 hours. Help!
Thanks,
Eric
First I read the data from the table and populate a dialog with the
fields I want to allow as editable.
When the user clicks the Save button I have an update query that
gathers data from the fields and performs an update in the table.
This modified data is used as parameters in the SQL statement.
The problem is that all the fields but one seem to update just fine.
The one field gets the updated information from the dialog, but for
some reason that particular field is not updated in the database
table.
The code goes something like this ...
DaDataMod.qryUpdateUserInfo.ParamByName(`UserID').asInteger :=
UserInfo.UserID; // This is just a data type with current user info
DaDataMod.qryUpdateUserInfo.ParamByName(`FirstName').asString :=
txtFirstName.Text;
DaDataMod.qryUpdateUserInfo.ParamByName(`LastName').asString :=
txtLastName.Text;
DaDataMod.qryUpdateUserInfo.ParamByName(`EmailAddress').asString :=
txtEmail.Text;
DaDataMod.qryUpdateUserInfo.ExecSQL;
DaDataMod.qryUpdateUserInfo.IB_Transaction.CommitRetaining;
The qryUpdateUserInfo Query looks like this:
UPDATE "UserInfo" SET
"FirstName" = :FirstName,
"LastName" = :LastName,
"EmailAddress" = :EmailAddress
WHERE
"UserID" = :UserID
I have debugged this and can clearly see that ALL the fields have the
new data, but the Email field stubbornly refuses to take on a new
value. I have checked and in the database, the Email field is just a
VARCHAR(50).
I have tried to look at the SQL statement submitted (using:
DaDataMod.qryUpdateUserInfo.ServerSQL), but this is what I see in my
log file:
4:56:12 PM 4/1/2004 SaveAccountInfo: SQL=
UPDATE "UserInfo" SET
"FirstName" = ? /* FirstName */ ,
"LastName" = ? /* LastName */ ,
"EmailAddress" = ? /* EmailAddress */
WHERE
"UserID" = ? /* userid */
I have two questions:
1) Is there something better than ServerSQL to use to see that actual
SQL string submitted? I have tried SQL.Text, but that only show the
parameters before the substitution
2) Why would all the fields be updated except the EmailAdress field?
I have been `noodling' with this for the past 2 hours. Help!
Thanks,
Eric