473,395 Members | 1,456 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Syntax Error in INSERT INTO,UPDATE statement

I am facing problem while inserting new rows into a access database.

The code i've written for doing so into button_click event is:-

Expand|Select|Wrap|Line Numbers
  1. dim con as OledbConnection
  2. dim s as String
  3. dim cmd as OledbCommand
  4.  
  5. con=New OledbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=D:\nazarath.mdb")
  6.  
  7. s="Insert into majorhead (mjhd, desc) Values ( '" & Me.TextBox1.Text & "','" & Me.TextBox2.Text & "')"
  8.  
  9. cmd=New OledbCommand(s, con)
  10.  
  11. con.Open()
  12.  
  13. cmd.ExecuteNonQuery()
  14.  
  15. con.Close
I'm developing in asp.NET application.


I' ve done so rightly yesterday. But today I'm facing problem.
Feb 23 '07 #1
1 946
vijaydiwakar
579 512MB
I am facing problem while inserting new rows into a access database.

The code i've written for doing so into button_click event is:-

dim con as OledbConnection
dim s as String
dim cmd as OledbCommand

con=New OledbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0; DATA Source=D:\nazarath.mdb")

s="Insert into majorhead (mjhd, desc) Values ( '" & Me.TextBox1.Text & "','" & Me.TextBox2.Text & "')"

cmd=New OledbCommand(s, con)

con.Open()

cmd.ExecuteNonQuery()

con.Close

I'm developing in asp.NET application.


I' ve done so rightly yesterday. But today I'm facing problem.
Dear first of all just rename the field name form desc to mydescription or any other name b'coz desc is reserved word in mdb and then tell me the problem
Feb 23 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

14
by: bolidev | last post by:
I'm new to SQL and can't figure out how to update my table (StoreItemStatus) that contains the current status for items in each store (STORE_KEY, ITEM_KEY, STATUS,...). I get updated status info...
4
by: Bob Stearns | last post by:
The statement: merge into nullid.animals_et_in t1 using is3.animals t2 on t1.sire_assoc=t2.assoc and t1.sire_prefix=t2.prefix and t1.sire_regnum=t2.regnum when matched then update set...
3
by: William | last post by:
i am using a dataset and a DataAdapter to update a table with the following schema: ResourceID ProjectID LastName FirstName Year Nov Dec Jan
7
by: kosta | last post by:
hello! one of my forms communicates with a database, and is supposed to add a row to a table using an Insert statement... however, I get a 'oledb - syntax error' exception... I have double...
0
by: compuglobalhypermeganetz0r | last post by:
I am having trouble getting an adapter to update my access database, it gives the error Syntax error in INSERT INTO statement. for Line 98: Adapter.Update(WineDS, "tblWines") Below is my...
5
by: amitbadgi | last post by:
Hi guys, I am getting the following error in teh insert statement , I am converting this asp application to asp.net, here is teh error, Exception Details:...
2
by: RSH | last post by:
I have a rather simple script that transfers data from a SQL server database to an Access database. The procedure is intended to be dynamic so I am basically adding a datarow and then passing the...
4
by: Warex | last post by:
Maybe someone can help, my code works untill it gets to update when it tells me Syntax error in INSERT INTO statement. Thought this was automaticaly created according to MS. Im lost, my code is...
4
by: cluce | last post by:
I am getting a syntax error but I cant seem to spot it. need help with this. Its when I click the save button that fires my SQL UPDATE query. thansk in advance 'module level declarations Dim...
4
by: hathan | last post by:
Hi, i am trying to add a new row into a microsoft access database and cant understand why it wont work. Can anyone please help me understand what this means? The error message says: **************...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...

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.