473,756 Members | 3,499 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dynamically assign Select Statement to SqlDataSource

I would like to dynamically assign a Select Statment to a a
SqlDataSource. Problem is the SqlDataSource.S elect() Command requires
a "dataSourceSele ctArgument" 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.I nsertCommand = "INSERT INTO cart (userID, SID,
itemID, quantity) VALUES ('value1', '"
+ curSessionID
+ "', '"
+ itemID
+"', 1)";
SqlDataSource.S elect();
---------------------------------------------------------
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:SqlDataSou rce
ID="top20_DataS ource"
DataSourceMode= "DataSet"
runat="server"
ProviderName=Sy stem.Data.Odbc
ConnectionStrin g="<%$ ConnectionStrin gs:Conn%>"
SelectCommand=" SELECT itemID, style, title, performers, date,
location, about_item, HTMLimgTag, img_tag_60_x_60 ">
</asp:SqlDataSour ce>
---------------------------------------------------------

Any Answers would be greatly appreciated.

May 16 '06 #1
0 3383

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

Similar topics

5
4480
by: Martin Bischoff | last post by:
Hi, is it possible to modify the values of a SqlDataSource's select parameters in the code behind before the select command is executed? Example: I have an SqlDataSource with a ControlParameter <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:XYZ %>"
15
26928
by: Swetha | last post by:
Hello I have a DropDownList that I am populating using the following SqlDataSource: <asp:DropDownList ID="parentIDDropDownList" runat="server" DataSourceID="SqlDataSource3" DataTextField="name" DataValueField="ID"></asp:DropDownList><asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
19
12277
by: matt | last post by:
I've seen several posts that begin to address this problem, but have not found a simple, elegant solution that will accomplish this goal. The important part of this solution is that it must be completely dynamic - I have over 40 different categories of devices, each with different fields, and each search will return only one category. I have no knowledge of the number or datatype of these field names beforehand and must use the sp to...
7
1299
by: VJ | last post by:
SELECT , , , , FROM WHERE (( = @Department) OR ( LIKE '%' + @First_Name + '%')) this is my sql statement on my GridView but I can't get the values to display? -- Sent via .NET Newsgroups http://www.dotnetnewsgroups.com
1
8434
by: VB Programmer | last post by:
Asp.net 2.0... I have an SqlDataSource on my aspx form. It's defined as... <asp:SqlDataSource ID="sdsCoupons" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT ShoppingCoupons.*, CouponCode AS Expr1 FROM ShoppingCoupons WHERE (CouponCode = @CouponCode)"> <SelectParameters> <asp:ControlParameter ControlID="txtCouponCode" DefaultValue="000"
1
5415
by: VB Programmer | last post by:
I have a SqlDataSource I setup on an ASP.NET 2.0 webform. I setup the SELECT statement and it has 1 parameter, @ProductId. How do I, using VB.NET, store the results of that SELECT statement into a datatable or dataview, for example? Here's partial code... Dim ds As New DataSet Dim dv As New DataView
1
1333
by: Dabbler | last post by:
I have a GridView attached to a SqlDataSource control. In the codebehind I modify the SqlDataSource based on users choice of search column and search value which I use to generate the select statement for the SqlDataSource. The problem is the select I create from the users entries is not saved in the state view, so I reissue the build of the select in Page_Load. When the user selects a row with select button it's pulling up the row from...
1
5176
by: rosie2006 | last post by:
Environment: .net2.0 over oracle Problem? a simple select statement within a DetailsView that gets two parameter values from a GridView SelectedValue. It might be valuable to understand that to pull a single record from this particular table requires two parameters. What follows defies understanding. The desired query: <asp:SqlDataSource .....
3
9009
by: =?Utf-8?B?Um9iZXJ0IFNtaXRo?= | last post by:
Hi, I have a GridView with a checkbox column in it called FromInsight, however this is not bound to the dataset, its value is based on another column from the dataset called sourceid For each row FromInsight = true if (SourceId 0). I try to loop around the gridview and add the value of the checkbox but the column seems to have no checked value, please can you help with this. Thanx in advance Robert
0
9456
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9872
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9841
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8712
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7244
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6534
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5141
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5303
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2666
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.