This simple ADO.NET connection is causing errors - HELP!!!!

  • Thread starter Thread starter Steve1 via DotNetMonster.com
  • Start date Start date
S

Steve1 via DotNetMonster.com

Hi all,

What wrong with the below snippit of code? I believe I've called the this
function correctly and besides all the errors (immediately below) are
pointed to this snippit of code. Thanks in advance, Steve.

} expected
Invalid token '(' in class, struct, or interface member declaration
Invalid token '(' in class, struct, or interface member declaration
Invalid token '(' in class, struct, or interface member declaration
Invalid token '(' in class, struct, or interface member declaration
Type or namespace definition, or end-of-file expected

public class cls_ConvertThreeDatabases
{
public void ConvertDatabases(string str_Source, string
str_Destination)
{
public string str_SourcePath = @"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source = " + str_Source ;
public string str_DestinationPath = @"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source = " + str_Destination ;

OleDbConnection obj_SourceConn = new OleDbConnection
(str_SourcePath);
OleDbConnection obj_DestinationConn = new OleDbConnection
(str_DestinationPath);

obj_SourceConn.Open();
obj_DestinationConn.Open();

obj_Destination.Close();
obj_Source.Close();

return;
}
}
 
I have included the 'Using System.Data.OleDb' at the very top of the class
file.

Thanks, Steve.
 
Back
Top