This is a migrated thread and some comments may be shown as answers.

how to pass valus to SqlDataSource's parameters

2 Answers 82 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Esperanza Ramos
Top achievements
Rank 1
Esperanza Ramos asked on 13 May 2008, 02:02 PM
Hi, All:

I am trying to use SqlDataSource.Update() to save records.

<

asp:SqlDataSource ID="sdsUpdateAll" runat="server" ConnectionString="<%$ ConnectionStrings:ConnString %>">
<UpdateParameters>
<asp:Parameter Name="billed" Type="DateTime" ConvertEmptyStringToNull="true" />
</UpdateParameters>
</
asp:SqlDataSource>

and:

sdsUpdateAll.UpdateCommand =

string.Format("update MyTable set  Billed = @billed " + ...

sdsUpdateAll.Update();

My question is: How to pass a value, say '5/10/2008', into parameter @billed.

thanks.

Stanley

2 Answers, 1 is accepted

Sort by
0
Esperanza Ramos
Top achievements
Rank 1
answered on 13 May 2008, 04:11 PM
Hi, All:

Thanks.  I solved the situation by using stored procedures.  sorry.

Stanley
0
Shanmug
Top achievements
Rank 1
answered on 11 Sep 2008, 06:50 PM
Hi All,
I'm also having a same kind of problem. I'm using the SqlDataSource and Select Command with Parameters in the .aspx itself. I need to pass one of my Session values as the parameter value in the WHERE Clause of the Select statement in the Select Command. How can I pass the server side Session value in the .aspx?
Tags
Grid
Asked by
Esperanza Ramos
Top achievements
Rank 1
Answers by
Esperanza Ramos
Top achievements
Rank 1
Shanmug
Top achievements
Rank 1
Share this question
or