Insert records into a dbase table

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm writing a c# Windows program that needs to be able to insert records
into a dbase table. I can read it using a dataset but can't insert records. I
receive the following error,

ERROR [HY000] [Microsoft][ODBC dBase Driver] Unexpected error from external
database driver (15877).

What is wrong?
 
Here is the code,

System.Data.OleDb.OleDbConnection ec = new
System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\\Dir\\TimeClock;Extended Properties=dBase 5.0");

System.Data.OleDb.OleDbCommand cmd = new
System.Data.OleDb.OleDbCommand();
cmd.CommandType = CommandType.Text;
cmd.Connection = ec;
cmd.CommandText = "INSERT INTO INV2 " +
"(PURCHASE_N, BILLING_N, DESCRIPT, COMPANY_N, SALES_NO,
LINE_N) " +
" VALUES ('cmd Purch', '6', 'CMD Desc', 'cmpny', '4', '60')";
ec.Open();
cmd.ExecuteNonQuery();
ec.Close();
 
Dave,

The key is included in that insert?

Cor

Dave said:
Here is the code,

System.Data.OleDb.OleDbConnection ec = new
System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\\Dir\\TimeClock;Extended Properties=dBase 5.0");

System.Data.OleDb.OleDbCommand cmd = new
System.Data.OleDb.OleDbCommand();
cmd.CommandType = CommandType.Text;
cmd.Connection = ec;
cmd.CommandText = "INSERT INTO INV2 " +
"(PURCHASE_N, BILLING_N, DESCRIPT, COMPANY_N, SALES_NO,
LINE_N) " +
" VALUES ('cmd Purch', '6', 'CMD Desc', 'cmpny', '4',
'60')";
ec.Open();
cmd.ExecuteNonQuery();
ec.Close();

Dave said:
I'm writing a c# Windows program that needs to be able to insert records
into a dbase table. I can read it using a dataset but can't insert
records. I
receive the following error,

ERROR [HY000] [Microsoft][ODBC dBase Driver] Unexpected error from
external
database driver (15877).

What is wrong?
 
Yes the key was included with the insert.

Cor Ligthert said:
Dave,

The key is included in that insert?

Cor

Dave said:
Here is the code,

System.Data.OleDb.OleDbConnection ec = new
System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\\Dir\\TimeClock;Extended Properties=dBase 5.0");

System.Data.OleDb.OleDbCommand cmd = new
System.Data.OleDb.OleDbCommand();
cmd.CommandType = CommandType.Text;
cmd.Connection = ec;
cmd.CommandText = "INSERT INTO INV2 " +
"(PURCHASE_N, BILLING_N, DESCRIPT, COMPANY_N, SALES_NO,
LINE_N) " +
" VALUES ('cmd Purch', '6', 'CMD Desc', 'cmpny', '4',
'60')";
ec.Open();
cmd.ExecuteNonQuery();
ec.Close();

Dave said:
I'm writing a c# Windows program that needs to be able to insert records
into a dbase table. I can read it using a dataset but can't insert
records. I
receive the following error,

ERROR [HY000] [Microsoft][ODBC dBase Driver] Unexpected error from
external
database driver (15877).

What is wrong?
 

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

Back
Top