471,356 Members | 1,638 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,356 software developers and data experts.

nested query and dataset

Hi,

i am using the following query

string query = "SELECT *"+
"FROM DataSet"+
"WHERE Param_ID =(Select Data1 from testcases
where TestCaseID='TC001')
DataAdapter da=new DataAdapter();
mycommand = new OleDbCommand(query, mycon);
myds = new System.Data.DataSet();
da = new OleDbDataAdapter();
da.SelectCommand = mycommand;
===============PROBLEM================
//da.TableMappings.Add("Table", "testcases");
da.TableMappings.Add("Table", "DataSet");

if i add both the tables compiler gives error.
Apr 7 '08 #1
3 2145
I doubt that the *compiler* would complain about that. The runtime might
throw an exception - firstly because you have duplicated the
table-name, and second because you only seem to be returning a single
grid of data...

Perhaps post the actual error text?

Marc
Apr 7 '08 #2
capture the error with
try
{
da.TableMappings.Add("Table", "DataSet");
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}

Apr 7 '08 #3
Nannu,

As Marc wrote already will your code forever only returning one row.

As you want to retrieve two resultsets in one fill, you need at least to map
table and table1 (or any tablename you start with your fill).

Cor

"nannu" <na********@gmail.comschreef in bericht
news:d2**********************************@s33g2000 pri.googlegroups.com...
Hi,

i am using the following query

string query = "SELECT *"+
"FROM DataSet"+
"WHERE Param_ID =(Select Data1 from testcases
where TestCaseID='TC001')
DataAdapter da=new DataAdapter();
mycommand = new OleDbCommand(query, mycon);
myds = new System.Data.DataSet();
da = new OleDbDataAdapter();
da.SelectCommand = mycommand;
===============PROBLEM================
//da.TableMappings.Add("Table", "testcases");
da.TableMappings.Add("Table", "DataSet");

if i add both the tables compiler gives error.

Apr 7 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Steve Klett | last post: by
reply views Thread by George Durzi | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.