I have the following code
mycon=new SqlConnection();
mycon.ConnectionString="'Provider =Microsoft.ACE.OLEDB.12.0';Data Source='G:\\Abbriviations\\Abbriviations\\App_Data\\abbreviations.accdb'";
myds=new DataSet();
mytable = new DataTable("Abbriviations");
myds.Tables.Add(mytable);
myadap=new SqlDataAdapter();
I am getting the following error.
Format of the initialization string does not conform to specification starting at index 0.
Can you please guide me the correct connectionstring for this.
Thanks Edit
public class dataManipulationClass
{
public OleDbConnection mycon;
public DataSet myds;
public DataTable mytable;
public SqlDataAdapter myadap;
public OleDbCommand mycomm;
public bool ManupulateData()
{
mycon = new OleDbConnection();
mycon.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=G:\\Abbriviations\\Abbriviations\\App_Data\\abbreviations.accdb";
myds=new DataSet();
mytable = new DataTable("Abbriviations");
myds.Tables.Add(mytable);
myadap=new SqlDataAdapter();
mycomm=new OleDbCommand();
mycomm.CommandType=CommandType.Text;
mycomm.CommandText = "SELECT * FROM Abbriviations";
mycomm.Connection=mycon;
myadap.SelectCommand=mycomm;
return true;
}
}
Now i am getting the following error at mycommm.
Cannot implicitly convert type 'System.Data.OleDb.OleDbCommand' to 'System.Data.SqlClient.SqlCommand'
Thanks