C
C#•2y ago
BambiAria

Need help with this exception "System.Data.OleDb.OleDbException: 'Could not find installable ISAM."

code:
7 Replies
BambiAria
BambiAriaOP•2y ago
void GetDatabaseConnection1()
{

//this is going to be ran after logging in
//Creates a connection with the database
string DbfilePath = @"C:\Users\matth\source\repos\Project code iteration one\Project but forms\Project but forms\bin\Debug\ProjectDataBase.accdb";
connection = new OleDbConnection("Provider=Microsoft.ACE.OleDb.16.0;DataSource=" + DbfilePath);
dt = new DataTable();
adapter = new OleDbDataAdapter("SELECT *FROM MainCalculationTable",connection);
connection.Open();
adapter.Fill(dt);
connection.Close();
}

void Insert()
{
connection = new OleDbConnection("Provider=Microsoft.ACE.OleDb.16.0; Data Source = ProjectDataBase.accdb");
GetDatabaseConnection1();
string query = "INSERT INTO StudentTable (YearGroup,FormGroup,FirstName,LastName,ScienceType) VALUES" + "(@yearGroup,@formGroup,@firstName,@lastName,@scienceType)";
cmd = new OleDbCommand(query, connection);

cmd.Parameters.AddWithValue("@yearGroup",yearGroupInput.Text);
cmd.Parameters.AddWithValue("@formGroup",formGroupTextBox.Text);
cmd.Parameters.AddWithValue("@firstName",firstNameTextBox.Text);
cmd.Parameters.AddWithValue("@lastName",lastNameTextBox.Text);
cmd.Parameters.AddWithValue("@scienceType",scienceClassTextBox.Text);

connection.Open();
cmd.ExecuteNonQuery();
connection.Close();

}
void GetDatabaseConnection1()
{

//this is going to be ran after logging in
//Creates a connection with the database
string DbfilePath = @"C:\Users\matth\source\repos\Project code iteration one\Project but forms\Project but forms\bin\Debug\ProjectDataBase.accdb";
connection = new OleDbConnection("Provider=Microsoft.ACE.OleDb.16.0;DataSource=" + DbfilePath);
dt = new DataTable();
adapter = new OleDbDataAdapter("SELECT *FROM MainCalculationTable",connection);
connection.Open();
adapter.Fill(dt);
connection.Close();
}

void Insert()
{
connection = new OleDbConnection("Provider=Microsoft.ACE.OleDb.16.0; Data Source = ProjectDataBase.accdb");
GetDatabaseConnection1();
string query = "INSERT INTO StudentTable (YearGroup,FormGroup,FirstName,LastName,ScienceType) VALUES" + "(@yearGroup,@formGroup,@firstName,@lastName,@scienceType)";
cmd = new OleDbCommand(query, connection);

cmd.Parameters.AddWithValue("@yearGroup",yearGroupInput.Text);
cmd.Parameters.AddWithValue("@formGroup",formGroupTextBox.Text);
cmd.Parameters.AddWithValue("@firstName",firstNameTextBox.Text);
cmd.Parameters.AddWithValue("@lastName",lastNameTextBox.Text);
cmd.Parameters.AddWithValue("@scienceType",scienceClassTextBox.Text);

connection.Open();
cmd.ExecuteNonQuery();
connection.Close();

}
ive been told multiple things to it being due to me running with and X64 CPU and not having the device drivers for ISAM and it being due to my connection string but nothing has been clear or helpful yet
Mayor McCheese
Mayor McCheese•2y ago
DataSource should have a space, what version of ace do you have installed, not sure if there is a 64bit ace, is someone making you use access?
BambiAria
BambiAriaOP•2y ago
just thought access would be easier and now my project dead line is fast approaching and im not sure what ace version i have installed I presume i have a ace version installed but ive literally never touched databases or OleDb before this
Mayor McCheese
Mayor McCheese•2y ago
access isn't easier than anything you can't assume you have ace installed, especially if you didn't install it is this a work project using access? or a school project? unless something is absolutely requiring access, then it's not worth your time Alternatives are things like sqlite or sql express or postgres NB: sqlite requires no special installation either
BambiAria
BambiAriaOP•2y ago
Ohhhh might have a look at that then Yeah might need to have a look at installing it then 😭 Yeah it’s a school project
Mayor McCheese
Mayor McCheese•2y ago
Don't use access unless you absolutely have to
Accord
Accord•2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server