This code does not save any data in the dbf file. What is wrong here? Here is the code with the recommended changes. Thank you.
string connectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\TEMP;Extended Properties=dBase IV";
using (OleDbConnection connection = new OleDbConnection(connectionString))
using (OleDbCommand command = connection.CreateCommand())
{
connection.Open();
command.CommandText = @"CREATE TABLE TEST (Id Text, Changed Text, Tacos Text)";
command.ExecuteNonQuery();
}
using (OleDbConnection connection2 = new OleDbConnection(connectionString))
using (OleDbCommand command2 = connection2.CreateCommand())
{
connection2.Open();
command2.CommandText = @"Insert into TEST (Id, Changed, Tacos) VALUES ('One','Two','Three')";
try
{
command2.ExecuteNonQuery();
}
catch (Exception ee)
{
MessageBox.Show(ee.ToString());
}
}
new OleDbConnection(...)
and check if the path is really what you think it is. – Barrybarrymore