Fill strongly type dataset from stored procedure

G

Guest

Dear all,

I have a file-strongly type dataset, that have two independent table inside
it.
I want to fill the two table in the dataset by one stored procedure(have two
select sql on it) how can i do

e.g.
create spname
...
SELECT * FROM table1
SELECT * FROM table2
GO

and

Dataadapter.fill(dataset.table1)
but how about table2
 
C

Cor Ligthert [MVP]

Ken,

I will not garantee you that you get an answer, however the generated
Strongly Typed Dataset from version 2002/3 is completely different from
version 2005, so maybe can you tell what you use.

In fact it should at the fill be just telling the right table that you want
and nothing more.

Cor
 
W

W.G. Ryan - MVP

You can definitely do this. However if the table names in the stored procs
differ from the table names in your Typed DataSet, you'll need to specify
tableMappings (and probably column mappings if the columns don't match up).
MSN Search on tableMappings and there are many examples. HTH,

Bill
 
G

Guest

Thanks you, but not work

the stored procedures is
SELECT TABLE1.A, TABLE2.B FROM TABLE1 INNER JOIN TABLE2 ON x1=y1
SELECT SUM(TABLE1.C) AS TOTAL FROM TABLE2

THE STRONGLY TYPE dataset have two tables
one name is tblTable1, the other is tblTable2, the schema match the select
statement.

da.tablemappings.add("TABLE1", "tblTable1") '?? I think problem is here,
da.tablemappings.add("TABLE2", "tblTable2")
da.fill(ds)

Can you see the problem , please help me!
 
W

W.G. Ryan - MVP

Just to make sure, fill an untyped dataset with that query and check the
table names that it uses (It will create two tables - check the table names
of those) and make sure they match.
 

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

Top