By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,775 Members | 1,353 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,775 IT Pros & Developers. It's quick & easy.

Dynamically assign Select Statement to SqlDataSource

P: n/a
I would like to dynamically assign a Select Statment to a a
SqlDataSource. Problem is the SqlDataSource.Select() Command requires
a "dataSourceSelectArgument" as one of its arguments.

1. What if I don't have an argument to give to out our the Select
Statement. Or if the arguments are pre-assigned. Take the following
lines of code for example.
---------------------------------------------------------

SqlDataSource.InsertCommand = "INSERT INTO cart (userID, SID,
itemID, quantity) VALUES ('value1', '"
+ curSessionID
+ "', '"
+ itemID
+"', 1)";
SqlDataSource.Select();
---------------------------------------------------------
It's part of a standalone class; their is no coordinating .aspx page.
This brings me to my next question: Why does it work as part of the a
..aspx page without an argument? See Below:
---------------------------------------------------------
<asp:SqlDataSource
ID="top20_DataSource"
DataSourceMode="DataSet"
runat="server"
ProviderName=System.Data.Odbc
ConnectionString="<%$ ConnectionStrings:Conn%>"
SelectCommand="SELECT itemID, style, title, performers, date,
location, about_item, HTMLimgTag, img_tag_60_x_60 ">
</asp:SqlDataSource>
---------------------------------------------------------

Any Answers would be greatly appreciated.

May 16 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.