dkim18
asked on
A way to insert a value into a SqlDataSource??
Hi,
I am inserting a new record from the detailsview of insert mode.
I have a SqlDataSource to insert a new record.
If possible, I would like to insert a user's value coming from the WindowsIdentity.GetCurrent User(),Nam e.
<asp:SqlDataSource ...
InsertCommand="Insert into table(type, title,name) values(@type,@title,'admin ')
....</asp:SqlDataSource>
Instead of 'admin', I would like to grab the userID using WindowsIdentity.GetCurrent User(),Nam e.
and attach to that sqldatasource.
I am inserting a new record from the detailsview of insert mode.
I have a SqlDataSource to insert a new record.
If possible, I would like to insert a user's value coming from the WindowsIdentity.GetCurrent
<asp:SqlDataSource ...
InsertCommand="Insert into table(type, title,name) values(@type,@title,'admin
....</asp:SqlDataSource>
Instead of 'admin', I would like to grab the userID using WindowsIdentity.GetCurrent
and attach to that sqldatasource.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi,
Well, as far as I know there is no other, more "proper" way of doing it. You need to to pass the value from the user context to a variable which can be consumed by the datasource, then you are limited to a number possible choices, using the SessionParameter is probably the easiest, most "clean" implementation.
/Carl.
Well, as far as I know there is no other, more "proper" way of doing it. You need to to pass the value from the user context to a variable which can be consumed by the datasource, then you are limited to a number possible choices, using the SessionParameter is probably the easiest, most "clean" implementation.
/Carl.
ASKER
THat SessionParameter worked for me.
I don't know if that is proper way of doing thing but for now i think i will use that.