473,769 Members | 5,910 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Insert records into a dbase table

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
3 5708
Here is the code,

System.Data.Ole Db.OleDbConnect ion ec = new
System.Data.Ole Db.OleDbConnect ion("Provider=M icrosoft.Jet.OL EDB.4.0;Data
Source=c:\\Dir\ \TimeClock;Exte nded Properties=dBas e 5.0");

System.Data.Ole Db.OleDbCommand cmd = new
System.Data.Ole Db.OleDbCommand ();
cmd.CommandType = CommandType.Tex t;
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.ExecuteNonQ uery();
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
Dave,

The key is included in that insert?

Cor

"Dave" <Da**@discussio ns.microsoft.co mschreef in bericht
news:EE******** *************** ***********@mic rosoft.com...
Here is the code,

System.Data.Ole Db.OleDbConnect ion ec = new
System.Data.Ole Db.OleDbConnect ion("Provider=M icrosoft.Jet.OL EDB.4.0;Data
Source=c:\\Dir\ \TimeClock;Exte nded Properties=dBas e 5.0");

System.Data.Ole Db.OleDbCommand cmd = new
System.Data.Ole Db.OleDbCommand ();
cmd.CommandType = CommandType.Tex t;
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.ExecuteNonQ uery();
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
Yes the key was included with the insert.

"Cor Ligthert [MVP]" wrote:
Dave,

The key is included in that insert?

Cor

"Dave" <Da**@discussio ns.microsoft.co mschreef in bericht
news:EE******** *************** ***********@mic rosoft.com...
Here is the code,

System.Data.Ole Db.OleDbConnect ion ec = new
System.Data.Ole Db.OleDbConnect ion("Provider=M icrosoft.Jet.OL EDB.4.0;Data
Source=c:\\Dir\ \TimeClock;Exte nded Properties=dBas e 5.0");

System.Data.Ole Db.OleDbCommand cmd = new
System.Data.Ole Db.OleDbCommand ();
cmd.CommandType = CommandType.Tex t;
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.ExecuteNonQ uery();
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
13399
by: george | last post by:
This is like the bug from hell. It is kind of hard to explain, so please bear with me. Background Info: SQL Server 7.0, on an NT box, Active Server pages with Javascript, using ADO objects. I'm inserting simple records into a table. But one insert command is placing 2 or 3 records into the table. The 'extra' records, have the same data as the previous insert incident, (except for the timestamp).
14
4300
by: serge | last post by:
I have a scenario where two tables are in a One-to-Many relationship and I need to move the data from the Many table to the One table so that it becomes a One-to-One relationship. I need to salvage the records from the many table and without going into detail, one of the reasons I can't do the opposite as there are records in the ONE table that I need to keep even if they don't have any child records in the MANY table. Below I created...
16
17018
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums must be UPDATED, if not, they must be INSERTED. Logically then, I would like to SELECT * FROM <TABLE> WHERE ....<Values entered here>, and then IF FOUND UPDATE <TABLE> SET .... <Values entered here> ELSE INSERT INTO <TABLE> VALUES <Values...
0
1753
by: htmlgeek | last post by:
I'm adding and updating records in an Access .mdb via WWW .asp page. Authored in Dreamweaver 2004 MX. Help is welcome on this one. I have a great set of pages that work fine, but it seems that insert or update pages don't always work now on some records . . . It seems that when lots of text is shoved into a memo fields the database ID for that record gets messed up. Intial record insertion goes OK, but updating is then hosed.
0
1856
by: Sharon | last post by:
I have a problem using with dbf file here. I have tried the code below using VB.NET with no errors. However, I use the exact same code in ASP NET, it prompt me error when I tried to insert a record. The error Detail : ERROR Operation must use an updateable query. Description: An unhandled exception occurred during the execution of the
3
6338
by: Bob Alston | last post by:
I have a routine to copy data to new versions of my app via insert into sql statements. Unfortunately, due to evolution of my app, sometimes the new version has more restrictive editing than an older version that I am updating. Thus I get this message. It tells me only how many records have errors, not which errors or which records. Anyone have a nice solution to identifying the specific records involved? Maybe even the specific...
5
4592
by: djsdaddy | last post by:
Good Day All, I have some EEO data in an old dBase4 database that I have converted to an Access table. Since dBase was not a relational database, I didn't create any key fields. I linked all of the tables together on Employees' SSN; therefore, in order to use this data with the current Access database, I need to create a relationship between the old dBase4 EEO data and the Access employee data. The Access employee data was also an old dBase...
9
1990
by: tommurray | last post by:
Hi I am currently setting up a script so that it inserts information into one table and then follows onto the next few lines and checks to see if the user already has a row in a different table if not the script should insert into the database, if the user already has a row it will update the information by adding the numbers to the ones currently stored in the database. At present I am testing the second SQL insert which does not work?...
21
1911
by: rfdjr1 | last post by:
I'm using Access 2000. I have a raher simple database of my CD collection, with just three fields, Artist, Album Title and Type of Music. While going to update it today with a couple new CD's, I noticed that if I sort alphabetically by Artist it have 387 records but if I sort by Album Title it shows 393 records. Any idea why this would be? And I know of at least two titles that don't show up when I look for them under the Artist sort....
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10214
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9996
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9865
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8872
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7410
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3963
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3563
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.