K
Keith G Hicks
asp.net 2.0
When I use the wizard in VWD 2005 to set up a sqlDataSource it creates code
like this for the UpdateCommand:
UpdateCommand="UPDATE [Customers] SET [CustomerName] = @CustomerName, .....
WHERE ....
When I bind text boxes to the values in the SelectCommand, how does the
UpdateCommand know that the @CustomerName parameter goes with the correct
text box. Is it that the Bind("CustomerName") has the same field name as the
name of the "@" parameter? I don't see anythign else in the code that's
generated that would do that.
Ok, so having asked that here's my main question. I need to pass another
value into the update command that's NOT bound to a text box. For example:
UpdateCommand="UPDATE [Customers] SET [CustomerName] = @CustomerName,
[UpdatedBy] = ???????? ..... WHERE ....
I need to post the currently logged in user (My.User.Name) to the
"UpdatedBy" field in the database. How do I do this?
Lastly, when the wizard generates the UpdateCommand and DeleteCommand, why
does it put ALL the fields in the WHERE clause? That makes no sense to me. I
would normally only put the PK in the WHERE clause in an Update or Delete
statement.
Thanks (still learning),
Keith
When I use the wizard in VWD 2005 to set up a sqlDataSource it creates code
like this for the UpdateCommand:
UpdateCommand="UPDATE [Customers] SET [CustomerName] = @CustomerName, .....
WHERE ....
When I bind text boxes to the values in the SelectCommand, how does the
UpdateCommand know that the @CustomerName parameter goes with the correct
text box. Is it that the Bind("CustomerName") has the same field name as the
name of the "@" parameter? I don't see anythign else in the code that's
generated that would do that.
Ok, so having asked that here's my main question. I need to pass another
value into the update command that's NOT bound to a text box. For example:
UpdateCommand="UPDATE [Customers] SET [CustomerName] = @CustomerName,
[UpdatedBy] = ???????? ..... WHERE ....
I need to post the currently logged in user (My.User.Name) to the
"UpdatedBy" field in the database. How do I do this?
Lastly, when the wizard generates the UpdateCommand and DeleteCommand, why
does it put ALL the fields in the WHERE clause? That makes no sense to me. I
would normally only put the PK in the WHERE clause in an Update or Delete
statement.
Thanks (still learning),
Keith