By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
460,020 Members | 1,348 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 460,020 IT Pros & Developers. It's quick & easy.

Insert records into a dbase table

P: n/a
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?
Oct 6 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Here is the code,

System.Data.OleDb.OleDbConnection ec = new
System.Data.OleDb.OleDbConnection("Provider=Micros oft.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" wrote:
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?
Oct 6 '06 #2

P: n/a
Dave,

The key is included in that insert?

Cor

"Dave" <Da**@discussions.microsoft.comschreef in bericht
news:EE**********************************@microsof t.com...
Here is the code,

System.Data.OleDb.OleDbConnection ec = new
System.Data.OleDb.OleDbConnection("Provider=Micros oft.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" wrote:
>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?

Oct 8 '06 #3

P: n/a
Yes the key was included with the insert.

"Cor Ligthert [MVP]" wrote:
Dave,

The key is included in that insert?

Cor

"Dave" <Da**@discussions.microsoft.comschreef in bericht
news:EE**********************************@microsof t.com...
Here is the code,

System.Data.OleDb.OleDbConnection ec = new
System.Data.OleDb.OleDbConnection("Provider=Micros oft.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" wrote:
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?


Oct 16 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.