473,394 Members | 1,751 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How to set value of a SqlDataSource parameter in HTML code?

K B
Hi,

I have a gridview with a SqlDataSource. One of the parameters I need to
use in the update is the logged on person. The parameter was created
automatically, but I need to override the value with the "new" person
doing the update (e.g., sUser).

How can I do this please?

<asp:Parameter Name="LastUpdatedBy" Type="String" />

Thanks!
Kit

*** Sent via Developersdex http://www.developersdex.com ***
Mar 29 '06 #1
2 3842

How about:
protected void Page_Load(object sender, EventArgs e)
{
SetQueryParamter();
}
private void SetQueryParameter()
{
MySqlDataSource.SelectParameters["LastUpdatedBy"].DefaultValue = sUser;
}
"K B" wrote:
Hi,

I have a gridview with a SqlDataSource. One of the parameters I need to
use in the update is the logged on person. The parameter was created
automatically, but I need to override the value with the "new" person
doing the update (e.g., sUser).

How can I do this please?

<asp:Parameter Name="LastUpdatedBy" Type="String" />

Thanks!
Kit

*** Sent via Developersdex http://www.developersdex.com ***

Mar 30 '06 #2
That should work. An alternative would be to put the following in the
Page_Load:

SQLDataSource.UpdateParameters.Add(ParameterNameWi thoutTheAtSymbol, Value)
Where you need to make sure that the parameter is not yet created.
(thanks to 'clickon' who answered the same kind of question to me
yesterday).

--
Kees de Winter
"Dabbler" <Da*****@discussions.microsoft.com> wrote in message
news:CF**********************************@microsof t.com...

How about:
protected void Page_Load(object sender, EventArgs e)
{
SetQueryParamter();
}
private void SetQueryParameter()
{
MySqlDataSource.SelectParameters["LastUpdatedBy"].DefaultValue = sUser;
}
"K B" wrote:
Hi,

I have a gridview with a SqlDataSource. One of the parameters I need to
use in the update is the logged on person. The parameter was created
automatically, but I need to override the value with the "new" person
doing the update (e.g., sUser).

How can I do this please?

<asp:Parameter Name="LastUpdatedBy" Type="String" />

Thanks!
Kit

*** Sent via Developersdex http://www.developersdex.com ***

Mar 30 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Mike Kelly | last post by:
I've chosen to implement the "optimistic concurrency" model in my application. To assist in that, I've added a ROWVERSION (TIMESTAMP) column to my main tables. I read the value of the column in my...
3
by: michelle | last post by:
I am trying to get an output value from a stored procedure using sqlDataSource in asp.net 2.0. But I only get a null value for the output. Can someone please help? The sqlDataSource: ...
6
by: Dabbler | last post by:
I have a dropdownlist in a GridView ItemTemplate. I need to bind the ddl to an SqlDataSource, then have a value from a boundfield in the row be passed as the keyfield for select where clause. Im...
0
by: Ed | last post by:
All of a sudden my previously working code started throwing this error. from the SqlDatasource. I am using C# and Asp.net 2.0. Getting the following error: You have specified that your delete...
0
by: Managed Code | last post by:
Hello, I have a status and definition table. The status table's current status field relates the ID field of the definition table. I am trying to retrieve the definitions that are associated...
4
by: =?Utf-8?B?QmFidU1hbg==?= | last post by:
Hi, I have a GridView and a SqlDataSource controls on a page. The SqlDataSource object uses stored procedures to do the CRUD operations. The DataSource has three columns one of which -...
3
by: Ken Cox [Microsoft MVP] | last post by:
I've been going around and around on this one. I can't believe that it is "by design" as Microsoft says. Here's the situation: In *declarative* syntax, I'm trying to create a default datetime...
3
by: Roger Jordan | last post by:
Hello, I'm using a SQLDataSource with name SqlDataSource1, the DeleteCommand has a parameter, with isdefined in SqlDataSource.DeleteParameter: DELETE FROM WHERE =@ID The parameter is not...
4
by: justice750 | last post by:
Hi All, I am using a FormView control. The allows me to update records in the database. However, when a database field is null I can not update the field on the form. It works fine when the field...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.