getting multiple table results question using stored procedure

  • Thread starter Patrick Olurotimi Ige
  • Start date
P

Patrick Olurotimi Ige

When i run the code below with stored proc :-

I get only the first table results :-"templates"
even if i fill the dataset with another table for example
category,pages etc..

Any ideas?

Store procedure below:-
------------------------
ALTER PROCEDURE dbo.webpage
AS
Select template_id,template_header,template_footer from templates
Select link_id,link_text,link_url from links
Select category_id,category_text,category_url from category
Select page_id,page_category,page_title,page_subtitle,page_text from
pages
RETURN
GO

Dim TreetableDataSet As DataSet
Dim TreetableConnection As SqlConnection
Dim TreetableAdapter As SqlDataAdapter
'Dim cmdcommand As SqlCommand

TreetableConnection = New
SqlConnection("server=(local);database=northwind;integrated
security=true;")


TreetableAdapter = New SqlDataAdapter("webpage",
TreetableConnection)


TreetableDataSet = New DataSet
Try
TreetableConnection.Open()
TreetableAdapter.Fill(TreetableDataSet, "links")
TreetableDataGrid.DataSource = TreetableDataSet
TreetableDataGrid.DataMember = "links"
TreetableDataGrid.DataBind()
Catch TreetableException As SqlException
'TreetableExceptionLabel.Text = TreetableException.Message
Finally
TreetableConnection.Close()
End Try
 
P

Patrick Olurotimi Ige

Eliyahu thanks for the response.
But can you explain in details or give me an example.
Thx
 
E

Eliyahu Goldin

From the MSDN:

When the query specified returns multiple results, each result set is placed
in a separate table. Additional result sets are named by appending integral
values to the specified table name (for example, "Table", "Table1",
"Table2", and so on).

In your case you should find result set from table links under name
"links1", from category under "links2" and from pages under "links3". What
you get under name "links" is your result set from table templates since it
is the first one returned by the stored procedure.

Eliyahu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top