R
Roy
Hey all,
Here's a small VB codeblock that connects to a database and uses 2 SQL
queries then forms a relation for a master/detail view on the aspx side:
Private Sub Binddata(ByVal name As String)
Dim myconn As New
SqlConnection("server=localhost;uid=ser;pwd=none;database=et")
Dim mycom As New SqlCommand("select * from tbl1;select * from tbl2",
myconn)
myconn.Open()
Dim newadp As New SqlDataAdapter(mycom)
Dim newds As New DataSet
newadp.Fill(newds)
newds.Relations.Add("nested", newds.Tables(0).Columns("bookingnum"),
newds.Tables(1).Columns("bookingnum"))
main_list.DataSource = newds.Tables(0).DefaultView
myconn.Close()
main_list.DataBind()
End Sub
Now, my question to the group mind is how can I substitute 2 Stored
Procedures in place of those two queries above? This doesn't work,
though I would think it would:
Private Sub Binddata(ByVal name As String)
Dim myconn As New
SqlConnection("server=localhost;uid=user;pwd=none;database=et")
Dim mycom As New
SqlCommand("et.dbo.user_data_top;et.dbo.user_data_nested", myconn)
With mycom
..CommandType = CommandType.StoredProcedure
..Parameters.Add(New SqlParameter("@name", SqlDbType.NVarChar, 12)).Value
= name
End With
myconn.Open()
Dim newadp As New SqlDataAdapter(mycom)
Dim newds As New DataSet
newadp.Fill(newds)
newds.Relations.Add("nested", newds.Tables(0).Columns("bookingnum"),
newds.Tables(1).Columns("bookingnum"))
main_list.DataSource = newds.Tables(0).DefaultView
myconn.Close()
main_list.DataBind()
End Sub
Here's a small VB codeblock that connects to a database and uses 2 SQL
queries then forms a relation for a master/detail view on the aspx side:
Private Sub Binddata(ByVal name As String)
Dim myconn As New
SqlConnection("server=localhost;uid=ser;pwd=none;database=et")
Dim mycom As New SqlCommand("select * from tbl1;select * from tbl2",
myconn)
myconn.Open()
Dim newadp As New SqlDataAdapter(mycom)
Dim newds As New DataSet
newadp.Fill(newds)
newds.Relations.Add("nested", newds.Tables(0).Columns("bookingnum"),
newds.Tables(1).Columns("bookingnum"))
main_list.DataSource = newds.Tables(0).DefaultView
myconn.Close()
main_list.DataBind()
End Sub
Now, my question to the group mind is how can I substitute 2 Stored
Procedures in place of those two queries above? This doesn't work,
though I would think it would:
Private Sub Binddata(ByVal name As String)
Dim myconn As New
SqlConnection("server=localhost;uid=user;pwd=none;database=et")
Dim mycom As New
SqlCommand("et.dbo.user_data_top;et.dbo.user_data_nested", myconn)
With mycom
..CommandType = CommandType.StoredProcedure
..Parameters.Add(New SqlParameter("@name", SqlDbType.NVarChar, 12)).Value
= name
End With
myconn.Open()
Dim newadp As New SqlDataAdapter(mycom)
Dim newds As New DataSet
newadp.Fill(newds)
newds.Relations.Add("nested", newds.Tables(0).Columns("bookingnum"),
newds.Tables(1).Columns("bookingnum"))
main_list.DataSource = newds.Tables(0).DefaultView
myconn.Close()
main_list.DataBind()
End Sub