G
Guest
Hello -
I have the following stored procedure and code. I want to put the results
in two textboxes. I get to the part where I create the dataset and then I
don't know what to do. I tried using a dataview with no luck.
Stored procedure:
ALTER Proc spFillSbjRply
(
@key int
)
AS
Select
tblLogin.ScreenName, tblPost.Question
from tblPost
inner join tblLogin
ON tblLogin.UserID = tblPost.UserID
Where tblPost.PostID=@key
Click event of a button:
index = dgPost.SelectedIndex
key = dgPost.DataKeys(index)
Dim dsSbjRply as New DataSet
Dim cmdSbjRply as New SqlClient.SqlCommand()
Dim daSbjRply as New SqlClient.SqlDataAdapter()
Dim prmSbjRply as SqlClient.SqlParameter
cmdSbjRply = cnn.CreateCommand
cmdSbjRply.CommandType = CommandType.StoredProcedure
cmdSbjRply.CommandText = "spFillSbjRply"
prmSbjRply = cmdSbjRply.Parameters.Add("@key", SqlDbType.Int, 4)
prmSbjRply.Value = key
daSbjRply.SelectCommand = cmdSbjRply
daSbjRply.Fill(dsSbjRply, "PostQ")
I'M STUCK HERE.
Any help will be immensely appreciated!!
I have the following stored procedure and code. I want to put the results
in two textboxes. I get to the part where I create the dataset and then I
don't know what to do. I tried using a dataview with no luck.
Stored procedure:
ALTER Proc spFillSbjRply
(
@key int
)
AS
Select
tblLogin.ScreenName, tblPost.Question
from tblPost
inner join tblLogin
ON tblLogin.UserID = tblPost.UserID
Where tblPost.PostID=@key
Click event of a button:
index = dgPost.SelectedIndex
key = dgPost.DataKeys(index)
Dim dsSbjRply as New DataSet
Dim cmdSbjRply as New SqlClient.SqlCommand()
Dim daSbjRply as New SqlClient.SqlDataAdapter()
Dim prmSbjRply as SqlClient.SqlParameter
cmdSbjRply = cnn.CreateCommand
cmdSbjRply.CommandType = CommandType.StoredProcedure
cmdSbjRply.CommandText = "spFillSbjRply"
prmSbjRply = cmdSbjRply.Parameters.Add("@key", SqlDbType.Int, 4)
prmSbjRply.Value = key
daSbjRply.SelectCommand = cmdSbjRply
daSbjRply.Fill(dsSbjRply, "PostQ")
I'M STUCK HERE.
Any help will be immensely appreciated!!