Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / April 2008

Tip: Looking for answers? Try searching our database.

nested query and dataset

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
nannu - 07 Apr 2008 10:18 GMT
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.
Marc Gravell - 07 Apr 2008 10:22 GMT
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
nologo - 07 Apr 2008 11:21 GMT
capture the error with
try
{
da.TableMappings.Add("Table", "DataSet");
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
Cor Ligthert [MVP] - 07 Apr 2008 12:00 GMT
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

> Hi,
>
[quoted text clipped - 14 lines]
>
>    if i add both the tables compiler gives error.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.