M
Mike
All the code samples I can find show using on its own or try... catch..
..finally on its own. Will the following cover me properly in terms of
handling errors and cleaning up?
string conns = "Provider=Microsoft.Jet.OleDb.4.0;Data
Source=|DataDirectory|Northwind.mdb";
try
{
using (OleDbConnection conn = new OleDbConnection(conns))
{
OleDbCommand cmd = new OleDbCommand("SELECT * From FOO", conn);
conn.Open();
OleDbDataReader rd = cmd.ExecuteReader();
//do stuff
}
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
Clearly Access and Response.Write are just being used for demo purposes...
..finally on its own. Will the following cover me properly in terms of
handling errors and cleaning up?
string conns = "Provider=Microsoft.Jet.OleDb.4.0;Data
Source=|DataDirectory|Northwind.mdb";
try
{
using (OleDbConnection conn = new OleDbConnection(conns))
{
OleDbCommand cmd = new OleDbCommand("SELECT * From FOO", conn);
conn.Open();
OleDbDataReader rd = cmd.ExecuteReader();
//do stuff
}
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
Clearly Access and Response.Write are just being used for demo purposes...