Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi,

 

I have created a dataset which is populated with the results from my Stored Procedure and then bound to my datalist. Everything works fine but I am not sure how to get the Ouput Paramater back from my SPROC through my dataset or otherwise. I know it can be done with the command.executenonquery method but I am not using that as I am just using the fill method of the dataset to get my results. Is there anyway I can pull this out through my dataset or a different method (other than command.executenonquery ?

 

Here is the relevant block of code containing the name of the output parameter:

 

------------------------------------------------------------

cmd.Parameters.Add("@FullCount", SqlDbType.Int)

cmd.Parameters("@FullCount").Direction = ParameterDirection.Output

 

Dim adapter As New SqlDataAdapter(cmd)

Dim ds As New DataSet()

 

adapter.Fill(ds)

 

ListResults.DataSource = ds.Tables(0).DefaultView

ListResults.DataBind()

 

How can I get the @FullCount parameter into a variable?

 

cheers

  • Administrators
Posted

cmd.Parameters.Add("@FullCount", SqlDbType.Int)
cmd.Parameters("@FullCount").Direction = ParameterDirection.Output

Dim adapter As New SqlDataAdapter(cmd)
Dim ds As New DataSet()

adapter.Fill(ds) 
Dim i as integer = cmd.Parameters("@FullCount").Value

 

should do it.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...