PC Review


Reply
Thread Tools Rate Thread

DataTable.Load Question:

 
 
probashi
Guest
Posts: n/a
 
      21st Feb 2007
Is there any thing wrong in the following code? Thanks.

----

public static DataTable GetDataTable()
{
DataTable dt = new DataTable();
string SQL = "select * from authors";

using (OracleConnection con = new
OracleConnection(System.Configuration.ConfigurationManager.AppSettings["ConnectionString"]))
{
using (OracleCommand comm = new OracleCommand(SQL,
con))
{
con.Open();
using (OracleDataReader ord =
comm.ExecuteReader())
{
dt.Load(ord);
}
}
}
return dt;
}

 
Reply With Quote
 
 
 
 
=?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
Guest
Posts: n/a
 
      22nd Feb 2007
are you sure your connection is being closed with this code? I'm not so sure.
take a look at CommandBehavior.CloseConnection
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net




"probashi" wrote:

> Is there any thing wrong in the following code? Thanks.
>
> ----
>
> public static DataTable GetDataTable()
> {
> DataTable dt = new DataTable();
> string SQL = "select * from authors";
>
> using (OracleConnection con = new
> OracleConnection(System.Configuration.ConfigurationManager.AppSettings["ConnectionString"]))
> {
> using (OracleCommand comm = new OracleCommand(SQL,
> con))
> {
> con.Open();
> using (OracleDataReader ord =
> comm.ExecuteReader())
> {
> dt.Load(ord);
> }
> }
> }
> return dt;
> }
>
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DataTable.Load() Scott M. Microsoft ADO .NET 10 8th Mar 2008 12:20 AM
DataTable Load Issue Kurt Microsoft ADO .NET 6 15th Feb 2008 05:57 AM
Internal of Datatable.load Archana Microsoft ADO .NET 0 18th Sep 2007 02:54 PM
load datatable as source for reportviewer =?Utf-8?B?SmFtZXMgTWFydGlu?= Microsoft ADO .NET 3 21st Dec 2005 08:06 AM
How to load DataTable into XMLDocument? Brett Romero Microsoft C# .NET 6 15th Dec 2005 06:34 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:18 PM.