DataTable.Load Question:

  • Thread starter Thread starter probashi
  • Start date Start date
P

probashi

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;
}
 
are you sure your connection is being closed with this code? I'm not so sure.
take a look at CommandBehavior.CloseConnection
Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top