G
Guest
Hello Guys,
I have created an admin class for my project. I have defined a function
which recieves a query from the program and executes a select statement and
return a dataset to the calling funtion in webform.
It worked fine until i was binding datagrids or datalist etc with the
datagrid.datasource routine. my issue is that on one of my pagge, i have
couple of labels and i want to to bind the values of these labels to the
value inside dataset.
Here is my code in my admin class:
Public Function selectQry(ByVal qry As String)
'this function executes the select statement
'the client needs to pass a query to it.
Dim ds As New DataSet
Dim conn As New SqlConnection(conStr)
Dim adapter As New SqlDataAdapter
adapter.SelectCommand = New SqlCommand(qry, conn)
adapter.Fill(ds)
Return ds
End Function
on my codebehind i am trying to do following:
Private Sub getDetail()
Dim dSet As DataSet
Dim i As Integer
dSet = data.selectQry("select * from tablename where id='" +
Request.QueryString("ID") + "'")
For i = 0 To data.selectQry("select * from tablename where id='" +
Request.QueryString("ID") + "'").tables(0).rows.count
lblName.Text = Convert.ToString(dSet.Tables(0).Rows(0).Item(0))
Next
'lblName.Text = Convert.ToString(dSet.Tables(0).Rows(0).Item(0))
End Sub
can someone please help?
thanks
Manny
I have created an admin class for my project. I have defined a function
which recieves a query from the program and executes a select statement and
return a dataset to the calling funtion in webform.
It worked fine until i was binding datagrids or datalist etc with the
datagrid.datasource routine. my issue is that on one of my pagge, i have
couple of labels and i want to to bind the values of these labels to the
value inside dataset.
Here is my code in my admin class:
Public Function selectQry(ByVal qry As String)
'this function executes the select statement
'the client needs to pass a query to it.
Dim ds As New DataSet
Dim conn As New SqlConnection(conStr)
Dim adapter As New SqlDataAdapter
adapter.SelectCommand = New SqlCommand(qry, conn)
adapter.Fill(ds)
Return ds
End Function
on my codebehind i am trying to do following:
Private Sub getDetail()
Dim dSet As DataSet
Dim i As Integer
dSet = data.selectQry("select * from tablename where id='" +
Request.QueryString("ID") + "'")
For i = 0 To data.selectQry("select * from tablename where id='" +
Request.QueryString("ID") + "'").tables(0).rows.count
lblName.Text = Convert.ToString(dSet.Tables(0).Rows(0).Item(0))
Next
'lblName.Text = Convert.ToString(dSet.Tables(0).Rows(0).Item(0))
End Sub
can someone please help?
thanks
Manny