public string; public using
i put the code below inside a Module but I encounter an error
Code:
public static string ConStr = "Provider=Microsoft.Jet.OleDB.4.0; Data Source =" + Application.StartupPath + "\\db1.mdb";
public using (OleDbConnection Conn = new OleDbConnection(ConStr))
what should I do?
Re: public string; public using
You can only use a 'using' block with local variables. The whole point of a 'using' block is to create an object and dispose it at the end of the block. It wouldn't make sense to dispose an object assigned to a member variable immediately would it? You would get rid of the 'using' and just declare a regular old OleDbConnection variable.