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

  • Thread starter Steve1 via DotNetMonster.com
  • 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;
}
}
 
S

Steve1 via DotNetMonster.com

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

Thanks, Steve.
 

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

Top