473,490 Members | 2,737 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

HelpMe: System.Data.OleDb.OleDbException: SyntaxError in INSERT INTO statement error"

7 New Member
Expand|Select|Wrap|Line Numbers
  1. Emailid = TBEmailName.Text & “” & CBDomain.Text
  2. Con = New OleDbConnection(“Provider=Microsoft.ACE.OleDb.12.0; Data Source=DataBase\Dashbard.accdb; Presist Info Security = False”)
  3.                Con.Open()
  4.                Cmd = New OleDbCommand(“INSERT INTO EmpDatas(EmpID,Name,EmailID,Password) VALUES(‘” & TBEmpID.Text & ”’,’” & TBEmpName.Text & ”’ ,’” & Emailid & ”’ ,’” & TBPass.Text & ”’)”, Con)
  5.                Cmd.ExecuteNonQuery()
  6.        MsgBox(“Data Saved Successfully”, MessageBox.Style= Information)
  7.        Con.Close()
  8.  
Jul 5 '11 #1
3 2261
code green
1,726 Recognized Expert Top Contributor
There is something wrong in this line
Expand|Select|Wrap|Line Numbers
  1. Cmd = New OleDbCommand(“INSERT INTO EmpDatas(EmpID,Name,EmailID,Password) VALUES(‘” & TBEmpID.Text & ”’,’” & TBEmpName.Text & ”’ ,’” & Emailid & ”’ ,’” & TBPass.Text & ”’)”, Con)
It is better to display the SQL query as a string to spot the problem
Jul 5 '11 #2
RameshKumar
7 New Member
Hi Code green,
I have one more project i have use the same coding. In that is working. Please check once again ya.
I have poste my full code in the below link
http://bytes.com/topic/net/answers/9...ry#post3665154
Jul 5 '11 #3
code green
1,726 Recognized Expert Top Contributor
I'd don't need to look at your code.
The problem is the SQL query itself.
Your code has no way of determining whether the data entered in the testboxes is valid.
The data in the texboxes then forms part of the query.
If the textboxes are empty or contain invalid characters the query will fail
Jul 5 '11 #4

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

Similar topics

9
1966
by: Wally | last post by:
I am trying to display images from an Access 2000 database and I get an error "Invalid Parameter Used" when I execute the code line "picBLOB.Image = Image.FromStream(stmBLOBData)" in my Visual...
0
2082
by: Mr.KisS | last post by:
Hello. I'm under Windows XP PRO SP1, IIS 5.1 ans SQL SERVER 2005 Express. When i try to open a connexion with : <connectionStrings> <add name="AppCnxStr"...
2
10628
by: Mr.KisS | last post by:
Hello. I'm under Windows XP PRO SP1, IIS 5.1 ans SQL SERVER 2005 Express. When i try to open a connexion with : <connectionStrings> <add name="AppCnxStr"...
3
8812
by: Brian Foree | last post by:
I am developing an ASP.NET application that uses Access 2000 as its backend, and have just started getting the following error on 2 ASP.NET pages that had been working until late last week (and I...
2
4498
by: Chris | last post by:
Hi, I want to show the whole recordset. There are 42 records and 2 fields. .... comd = New System.Data.OleDb.OleDbCommand("select name,lok from pc", oConnection) dtreader = comd.ExecuteReader...
3
2977
by: filip.norrgard | last post by:
Hi All! I've been developing an ASP.Net 2.0 web application using the Visual Studio 2005 tools. Currently datagrids on a page are filled with data from a dataset (a .xsd file in the "project")...
0
3541
by: DC | last post by:
The problem I'm using the .NET GridView and FormView objects for the first time and im getting the error "An OleDbParameter with ParameterName '@ID' is not contained by this...
1
9671
by: Carmine [www.thetotalsite.it] | last post by:
Hi, I am using ASP.Net 2.0 with the MySQL Connector .Net 5.1.2.2. I added these lines to the web.config to make the connector.net able to handle the SqlConnection object (and so to bind it to a...
6
5337
by: Bobby Edward | last post by:
Using ASP.NET 3.5 and MySQL (thru DevArt MyDirect.NET)... On the production server I get a "Parser Error" for every XSD dataset. It works perfect on my dev machine. But, on the production...
1
6417
by: AlsonToh | last post by:
No value given for one or more required parameters. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information...
0
7112
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
6974
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
7146
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,...
0
7183
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...
1
6852
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...
0
5448
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,...
0
4573
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...
1
628
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
277
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.