L
Laura K
This is probably a simple question but I want to make sure I am doing
it right.
I have a spoc with two select statements which results in two tables.
Very Basic
---------------------------------------------------------------------------------
@strProductCode nvarchar (50)
select *
from tblProducts
where strproductCode = @strProductCode
select * from tblJctProductColors
-----------------------------------------------------------------------------------
I will eventually set up a relationship between the two but first I
need to get them into one dataset as two tables. I am not sure of the
code. I have looked through past posts but I am still confused. Can
someone help. This is what I have so far.
-------------------------------------------------------------------------------------------------
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'retreive the prodcut code
Dim strProductCode = Request.QueryString("ProductCode")
'create the connection string
Dim connection As New SqlConnection(connectionString)
'Create and initialize the command Object
Dim command As New SqlCommand("New_getDetailsTables",
connection)
command.CommandType = CommandType.StoredProcedure
' Add an input parameter and supply a value for it
command.Parameters.Add("@strProductCode", SqlDbType.VarChar,
50)
command.Parameters("@strProductCode").Value = strProductCode
Dim mySqlDataAdapter As SqlDataAdapter = New
SqlDataAdapter(command)
Dim dsGetProducts As New DataSet
mySqlDataAdapter.Fill(dsGetProducts, "Products")
DataList1.DataSource = dsGetProducts.Tables("products")
DataList1.DataBind()
End Sub
I have got the dataset returning values from the first table in the
sproc but I need values from the second table.
I would like to have two tables from in the dataset. Products and
colors. The first select statement is products and the second is
colors. Can someone advise?
Thanks for any help!
Laura K
it right.
I have a spoc with two select statements which results in two tables.
Very Basic
---------------------------------------------------------------------------------
@strProductCode nvarchar (50)
select *
from tblProducts
where strproductCode = @strProductCode
select * from tblJctProductColors
-----------------------------------------------------------------------------------
I will eventually set up a relationship between the two but first I
need to get them into one dataset as two tables. I am not sure of the
code. I have looked through past posts but I am still confused. Can
someone help. This is what I have so far.
-------------------------------------------------------------------------------------------------
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'retreive the prodcut code
Dim strProductCode = Request.QueryString("ProductCode")
'create the connection string
Dim connection As New SqlConnection(connectionString)
'Create and initialize the command Object
Dim command As New SqlCommand("New_getDetailsTables",
connection)
command.CommandType = CommandType.StoredProcedure
' Add an input parameter and supply a value for it
command.Parameters.Add("@strProductCode", SqlDbType.VarChar,
50)
command.Parameters("@strProductCode").Value = strProductCode
Dim mySqlDataAdapter As SqlDataAdapter = New
SqlDataAdapter(command)
Dim dsGetProducts As New DataSet
mySqlDataAdapter.Fill(dsGetProducts, "Products")
DataList1.DataSource = dsGetProducts.Tables("products")
DataList1.DataBind()
End Sub
I have got the dataset returning values from the first table in the
sproc but I need values from the second table.
I would like to have two tables from in the dataset. Products and
colors. The first select statement is products and the second is
colors. Can someone advise?
Thanks for any help!
Laura K