Fill strongly type dataset from stored procedure

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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
 
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
 
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!
 
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.
 
Back
Top