473,769 Members | 5,601 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How store results of SqlDataSource SELECT statement?

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

For Each i As CartItem In Profile.MyShopp ingCart.CartIte ms

' SET THE SELECT PARAMETER
Me.sdsFreeShip. SelectParameter s("ProductId"). DefaultValue =
i.ID.Trim

' ERROR HERE... TRYING TO GET RESULTS OF SELECT AND STORE IT IN
dv VAR
' (Argument not specified error)
dv = Me.sdsFreeShip. Select

If dv.Table.Rows.C ount = 0 Then
' include in total
MyTotal += i.Price * i.Quantity
End If
Next

Thanks
Aug 17 '06 #1
1 5416
In the aspx page, for your DataTable or DataView you can set the
"DataSource Id" property as the name of your SqlDataSource.
--------------------
>From: "VB Programmer" <do**********@s omewhere.com>
Subject: How store results of SqlDataSource SELECT statement?
Date: Thu, 17 Aug 2006 14:29:00 -0400
Lines: 31
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2869
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962
Message-ID: <e4************ *@TK2MSFTNGP05. phx.gbl>
Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
NNTP-Posting-Host: 110.196.205.68. cfl.res.rr.com 68.205.196.110
Path: TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GP01.phx.gbl!TK 2MSFTNGP05.phx. gbl
Xref: TK2MSFTNGXA01.p hx.gbl microsoft.publi c.dotnet.framew ork.aspnet:4140 55
X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet

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

For Each i As CartItem In Profile.MyShopp ingCart.CartIte ms

' SET THE SELECT PARAMETER
Me.sdsFreeShip. SelectParameter s("ProductId"). DefaultValue =
i.ID.Trim

' ERROR HERE... TRYING TO GET RESULTS OF SELECT AND STORE IT
IN
>dv VAR
' (Argument not specified error)
dv = Me.sdsFreeShip. Select

If dv.Table.Rows.C ount = 0 Then
' include in total
MyTotal += i.Price * i.Quantity
End If
Next

Thanks
--

Thank You,
Nanda Lella,

This Posting is provided "AS IS" with no warranties, and confers no rights.

Aug 17 '06 #2

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

Similar topics

0
1219
by: Jason Shohet | last post by:
I'm using the new SqlDataSource with the beta. Below I have my code: asp:SqlDataSource ID="ds" Runat="server" SelectCommand="SELECT employee_ssno, firstname, lastname FROM employee_temp order by lastname" ConnectionString="<%$ ConnectionStrings:AppConnectionString1 %>" ProviderName="System.Data.OleDb" UpdateCommand="UPDATE DBOWEB.EMPLOYEE_TEMP SET firstname=?, lastname=? WHERE employee_ssno=?"> </asp:SqlDataSource>
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 %>"
2
5191
by: alain.hogue | last post by:
I have a table "tblCards" with a field "Titre" that contain french words (Hébert, Gagné, Hélène, etc....) in an database with SQLEXPRESS 2005. I have used the asp:SqlDataSource to filter the SELECT statement according to a Textbox the user can type into. When used with the LIKE condition using any acute caracters the SELECT statement return nothing, unless the acute caracters is replaced with an ampersand "%". Even the underscore "_"...
3
2334
by: Jim Andersen | last post by:
Hi, I would appreciate if someone could explain this behaviour, and maybe offer a better solution. I have been working with the GridView control. And SqlDataSource. It works great if I do: <asp:SqlDataSource ConnectionString="yada yada yada" etc etc />. I can hook up a GridView to the sqldatasource and view/edit/add records.
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"
0
3384
by: cyberbless | last post by:
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 =...
2
19794
by: phil | last post by:
Hi, I want to put a recordset in a gridview but i don't know how to pass the value of the variable in the 'where' statement. The value of the variable is set in the code-behind. i added a tag <selectParameters> but i don't know which elements are needed and how... This is my aspx file: <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\mydb.mdb"
1
3299
by: Jim McGivney | last post by:
I would like to return one specific value from an SQLDataSource configured to a table with an SQL Command selecting a specific value. It would be the equilivant of ExecuteScalar in OLEDB. Replies with code would be appreciated. Thanks Jim
0
2745
by: joebob8000 | last post by:
This seems like a simple task, but my 6 year old roots in classic ASP must be causing me trouble with my current problem. I am looking to provide a search for users in which they can select multiple categores (check boxes) and view only the results in those categories in a gridView control. My goal is to do so for movies, so an example would be if the user checks comedy and childrens then they would only get childrens comedies and the...
0
9587
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
10211
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10045
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
9993
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
8870
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...
0
6672
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
5298
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...
1
3958
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.