How store results of SqlDataSource SELECT statement?

V

VB Programmer

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.MyShoppingCart.CartItems

' SET THE SELECT PARAMETER
Me.sdsFreeShip.SelectParameters("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.Count = 0 Then
' include in total
MyTotal += i.Price * i.Quantity
End If
Next

Thanks
 
N

Nanda Lella[MSFT]

In the aspx page, for your DataTable or DataView you can set the
"DataSourceId" property as the name of your SqlDataSource.


--------------------
From: "VB Programmer" <[email protected]>
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: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.aspnet
NNTP-Posting-Host: 110.196.205.68.cfl.res.rr.com 68.205.196.110
Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSFTNGP05.phx.gbl
Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.framework.aspnet:414055
X-Tomcat-NG: microsoft.public.dotnet.framework.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.MyShoppingCart.CartItems

' SET THE SELECT PARAMETER
Me.sdsFreeShip.SelectParameters("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.Count = 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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,824
Latest member
Nater888

Latest Threads

Top