473,783 Members | 2,564 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

INSERT ERROR

I am trying to INSERT record in MYSQL database, but each time the code tries
to execute the command: MySQL_cmdGLAcco unt.ExecuteNonQ uery(), it reports an
error with the message
"COLUMN COUNT DOESN'T MATCH VALUE COUNT AT ROW 1"
Am using MYSQL CONNECTOR FOR NET VERY 1.0.3 as my provider. Am wondering
what is going on in my code. Below is part of the code.

MySQL_Cnn.Open( )
myTrans = MySQL_Cnn.Begin Transaction
MySQL_cmdGLAcco unt.Transaction = myTrans

strSQLInsert = "INSERT INTO
GLAccount(Accou ntNo,AccountNam e,AccountType,N ote,Suspend,Ret ainedEarnings,D ateTime) " _
& " VALUES (intAcctNo,'" & txtAccountName. Text & "','" &
strAccountType & "','" & txtNote.Text & "' " _
& " '" & strSuspend & "','" & strRetainedEarn ings &
"',NOWDATE) "
MySQL_cmdGLAcco unt.CommandText = strSQLInsert
MySQL_cmdGLAcco unt.Connection = MySQL_Cnn
MySQL_cmdGLAcco unt.ExecuteNonQ uery()
myTrans.Commit( )
Nov 21 '05 #1
3 1202
Here is the problem

You only have 6 values and 7 parameters. You are missing a comma.



"INSERT ERROR" wrote:
I am trying to INSERT record in MYSQL database, but each time the code tries
to execute the command: MySQL_cmdGLAcco unt.ExecuteNonQ uery(), it reports an
error with the message
"COLUMN COUNT DOESN'T MATCH VALUE COUNT AT ROW 1"
Am using MYSQL CONNECTOR FOR NET VERY 1.0.3 as my provider. Am wondering
what is going on in my code. Below is part of the code.

MySQL_Cnn.Open( )
myTrans = MySQL_Cnn.Begin Transaction
MySQL_cmdGLAcco unt.Transaction = myTrans

strSQLInsert = "INSERT INTO
GLAccount(Accou ntNo,AccountNam e,AccountType,N ote,Suspend,Ret ainedEarnings,D ateTime) " _
& " VALUES (intAcctNo,'" & txtAccountName. Text & "','" &
strAccountType & "','" & txtNote.Text & "' " _
& " '" & strSuspend & "','" & strRetainedEarn ings &
"',NOWDATE) "
MySQL_cmdGLAcco unt.CommandText = strSQLInsert
MySQL_cmdGLAcco unt.Connection = MySQL_Cnn
MySQL_cmdGLAcco unt.ExecuteNonQ uery()
myTrans.Commit( )

Nov 21 '05 #2
instead of concatinating values like that you should really used paramater
fields.

"INSERT ERROR" <IN*********@di scussions.micro soft.com> wrote in message
news:5F******** *************** ***********@mic rosoft.com...
I am trying to INSERT record in MYSQL database, but each time the code
tries
to execute the command: MySQL_cmdGLAcco unt.ExecuteNonQ uery(), it reports
an
error with the message
"COLUMN COUNT DOESN'T MATCH VALUE COUNT AT ROW 1"
Am using MYSQL CONNECTOR FOR NET VERY 1.0.3 as my provider. Am wondering
what is going on in my code. Below is part of the code.

MySQL_Cnn.Open( )
myTrans = MySQL_Cnn.Begin Transaction
MySQL_cmdGLAcco unt.Transaction = myTrans

strSQLInsert = "INSERT INTO
GLAccount(Accou ntNo,AccountNam e,AccountType,N ote,Suspend,Ret ainedEarnings,D ateTime)
" _
& " VALUES (intAcctNo,'" & txtAccountName. Text & "','" &
strAccountType & "','" & txtNote.Text & "' " _
& " '" & strSuspend & "','" & strRetainedEarn ings &
"',NOWDATE) "
MySQL_cmdGLAcco unt.CommandText = strSQLInsert
MySQL_cmdGLAcco unt.Connection = MySQL_Cnn
MySQL_cmdGLAcco unt.ExecuteNonQ uery()
myTrans.Commit( )

Nov 21 '05 #3
Missing a comma right here:

& txtNote.Text & "' " _
& " '" & strSuspend

"INSERT ERROR" <IN*********@di scussions.micro soft.com> wrote in message
news:5F******** *************** ***********@mic rosoft.com...I am trying to INSERT record in MYSQL database, but each time the code
tries
to execute the command: MySQL_cmdGLAcco unt.ExecuteNonQ uery(), it reports
an
error with the message
"COLUMN COUNT DOESN'T MATCH VALUE COUNT AT ROW 1"
Am using MYSQL CONNECTOR FOR NET VERY 1.0.3 as my provider. Am wondering
what is going on in my code. Below is part of the code.

MySQL_Cnn.Open( )
myTrans = MySQL_Cnn.Begin Transaction
MySQL_cmdGLAcco unt.Transaction = myTrans

strSQLInsert = "INSERT INTO
GLAccount(Accou ntNo,AccountNam e,AccountType,N ote,Suspend,Ret ainedEarnings,D ateTime)
" _
& " VALUES (intAcctNo,'" & txtAccountName. Text & "','" &
strAccountType & "','" & txtNote.Text & "' " _
& " '" & strSuspend & "','" & strRetainedEarn ings &
"',NOWDATE) "
MySQL_cmdGLAcco unt.CommandText = strSQLInsert
MySQL_cmdGLAcco unt.Connection = MySQL_Cnn
MySQL_cmdGLAcco unt.ExecuteNonQ uery()
myTrans.Commit( )

Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
7397
by: Jack | last post by:
I have a text file of data in a file (add2db.txt) where the entries are already entered on separate lines in the following form: INSERT INTO `reviews` VALUES("", "Tony's", "Lunch", "Great atmosphere. Good food.", " (Harry Houdini - 03/01/2004)"); INSERT INTO `reviews` VALUES("", "Le Chow Place", "Lunch", "yada yada", " (Herbert Hoover - 03/03/2004)"); INSERT INTO `reviews` VALUES("", "Golden Dragon", "Lunch", "Exquisite.
7
12129
by: iqbal | last post by:
Hi all, We have an application through which we are bulk inserting rows into a view. The definition of the view is such that it selects columns from a table on a remote server. I have added the servers using sp_addlinkedserver on both database servers. When I call the Commit API of oledb I get the following error: Error state: 1, Severity: 19, Server: TST-PROC22, Line#: 1, msg:
16
17019
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...
6
4711
by: harborboy76 | last post by:
Hi, I am trying to insert a large number of rows into a table inside a SPL. But every time, I run the SPL, the table is locked because of the INSERT. When I tried to issue a COMMIT, right after the INSERT in the SPL. I got an error stating that there was no open cursor. I have done some research on here and found that it's not possible to issue a COMMIT inside an SPL. But it can be done so on the client side. Can anyone shade me some...
8
2047
by: 73blazer | last post by:
Hello, I'm looking for a way to make some of my insert templates more readable by placing comments in between the values. I cannot seem to find a way to do this with DB2, is there a way? I'm probably missing something basic. I have insert into ken.snyder id1,id2,id3 values (
3
2313
by: MP | last post by:
Hi Posted this several hours ago to another ng but it never showed up thought i'd try here. using vb6, ado, .mdb, jet4.0, no access given table tblJob with field JobNumber text(10) 'The example I had to go by 'INSERT INTO tblCustomers (CustomerID, , )
3
5160
by: mahajanvit | last post by:
Hi one and all I got this problem during my project. So in order to solve this I made a very small application. I am trying to insert using SP and sqldatasource control. I know that while using sqldatasource control, there is no need of opening and closing a connection. Also there is no need to write connection string. When i am selecting table from sqldatasource and writing insert statement in C# code, its working fine. When I am...
9
3704
by: anachronic_individual | last post by:
Hi all, Is there a standard library function to insert an array of characters at a particular point in a text stream without overwriting the existing content, such that the following data in appropriately moved further down? From a cursory search of the libc documentation I can't find such a function. Will I have to write it myself? Thanks.
2
4815
by: technocraze | last post by:
Hi guys, I have encountered this error when updating the values to the MS Acess table. Error : Update on linked table failed. ODBC sql server error Timeout expired. MS Acess is my front end and sql server is my backend server. This error occured whenever i step through and when it reaches rs.update it jux hangs down there and thereafter it shwn the aforementioned error. I am using the RecordSet properties to add the values. Can I use...
6
3469
by: rn5a | last post by:
During registration, users are supposed to enter the following details: First Name, Last Name, EMail, UserName, Password, Confirm Password, Address, City, State, Country, Zip & Phone Number. I am using MS-Access 2000 database table for this app. Note that the datatype of all the fields mentioned above are Text. Apart from the above columns, there's another column in the DB table named 'RegDateTime' whose datatype is Date/Time which is...
0
9643
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
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
10315
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
10083
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
8968
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
7494
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
6737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3645
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.