Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Nov 9th, 2004, 10:52 PM   #1
nino
Newbie
 
Join Date: Nov 2004
Posts: 2
Rep Power: 0 nino is on a distinguished road
Good Day everyone.
I am new to C# and i am planning to port my vb.net framework to c#.
i have a problem regarding dataadapters.
here is the code:

public DataSet SelectSet(DataSet data_set, string table_name, string query)
{
   OleDbDataAdapter adapter = new OleDbDataAdapter();
   try
   {
     _Command.Connection = _Connection;
     _Command.CommandText = query;
     adapter.SelectCommand = _Command;
     adapter.Fill(data_set,table_name); 
   }
   catch(Exception ex)
   {
     System.Console.WriteLine(ex.StackTrace);
   }
   return data_set; 
}

The code actually works fine however i noticed that an exception is thrown when the result of the query is empty. The line adapter.Fill(data_set,table_name) causes the exception.
I actually passed a strongly typed DataSet into this method.
I am asking C# experts out there to please help. I'd really appreciate any advice.

(I threw you a few CODE tags, SykkN)
nino is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 10:28 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC