473,385 Members | 1,312 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,385 software developers and data experts.

insert into error not recognized

Good morning,
I've the following error
Syntax error in INSERT INTO statement
But I do not found any error in this code

OleDbconn = new OleDbConnection(sConnessioneDb);
string insertCmd = "insert into Organizzatori (NomeUtente, Password,
Nome, Cognome, IndirizzoPostaElettronica, Telefono) values ('eta' , 'eco' ,
'Antonioff' , 'ferfe' , 'p*********@etantonio.it' , '333333')";
OleDbCommand myCommand = new OleDbCommand(insertCmd, OleDbconn);
myCommand.Connection.Open();
try
{
myCommand.ExecuteNonQuery();
}
catch (OleDbException ex)
{
lblMsg1.Text = ex.Message ;
}
myCommand.Connection.Close();

Can you help me to discover the problem, I'm using an Access DB.

Many thanks

Antonio D'Ottavio
Sep 5 '05 #1
7 1210

"Antonio D'Ottavio" <po********@etantonio.it> wrote in message
news:eN**************@TK2MSFTNGP14.phx.gbl...
Good morning,
I've the following error
Syntax error in INSERT INTO statement
But I do not found any error in this code

OleDbconn = new OleDbConnection(sConnessioneDb);
string insertCmd = "insert into Organizzatori (NomeUtente, Password,
Nome, Cognome, IndirizzoPostaElettronica, Telefono) values ('eta' , 'eco'
,
'Antonioff' , 'ferfe' , 'po********@etantonio.it' , '333333')";
OleDbCommand myCommand = new OleDbCommand(insertCmd, OleDbconn);
myCommand.Connection.Open();
try
{
myCommand.ExecuteNonQuery();
}
catch (OleDbException ex)
{
lblMsg1.Text = ex.Message ;
}
myCommand.Connection.Close();

Can you help me to discover the problem, I'm using an Access DB.

Many thanks

Antonio D'Ottavio


Hi Antonio,
Have you checked the value types - e.g: is the '333333' a string or a long
value within database?
Sep 5 '05 #2
I think 'password' is a reserved word in Jet. Try enclosing it in square
brackets ([]).

"Antonio D'Ottavio" <po********@etantonio.it> wrote in message
news:eN**************@TK2MSFTNGP14.phx.gbl...
Good morning,
I've the following error
Syntax error in INSERT INTO statement
But I do not found any error in this code

OleDbconn = new OleDbConnection(sConnessioneDb);
string insertCmd = "insert into Organizzatori (NomeUtente, Password,
Nome, Cognome, IndirizzoPostaElettronica, Telefono) values ('eta' , 'eco' ,
'Antonioff' , 'ferfe' , 'po********@etantonio.it' , '333333')";
OleDbCommand myCommand = new OleDbCommand(insertCmd, OleDbconn);
myCommand.Connection.Open();
try
{
myCommand.ExecuteNonQuery();
}
catch (OleDbException ex)
{
lblMsg1.Text = ex.Message ;
}
myCommand.Connection.Close();

Can you help me to discover the problem, I'm using an Access DB.

Many thanks

Antonio D'Ottavio

Sep 5 '05 #3
I've changed the password filed with a pwd file, but I've again the error
....
Thanks the same

"Siva M" <sh******@online.excite.com> ha scritto nel messaggio
news:eI**************@TK2MSFTNGP14.phx.gbl...
I think 'password' is a reserved word in Jet. Try enclosing it in square
brackets ([]).

"Antonio D'Ottavio" <po********@etantonio.it> wrote in message
news:eN**************@TK2MSFTNGP14.phx.gbl...
Good morning,
I've the following error
Syntax error in INSERT INTO statement
But I do not found any error in this code

OleDbconn = new OleDbConnection(sConnessioneDb);
string insertCmd = "insert into Organizzatori (NomeUtente, Password, Nome, Cognome, IndirizzoPostaElettronica, Telefono) values ('eta' , 'eco' , 'Antonioff' , 'ferfe' , 'po********@etantonio.it' , '333333')";
OleDbCommand myCommand = new OleDbCommand(insertCmd, OleDbconn);
myCommand.Connection.Open();
try
{
myCommand.ExecuteNonQuery();
}
catch (OleDbException ex)
{
lblMsg1.Text = ex.Message ;
}
myCommand.Connection.Close();

Can you help me to discover the problem, I'm using an Access DB.

Many thanks

Antonio D'Ottavio

Sep 5 '05 #4
The field phone is a string ... I think is it right in this way, hope so
"James Jenkins" <Ja***@noSPAMtamarsolutions.co.uk> ha scritto nel messaggio
news:uZ*************@TK2MSFTNGP15.phx.gbl...

"Antonio D'Ottavio" <po********@etantonio.it> wrote in message
news:eN**************@TK2MSFTNGP14.phx.gbl...
Good morning,
I've the following error
Syntax error in INSERT INTO statement
But I do not found any error in this code

OleDbconn = new OleDbConnection(sConnessioneDb);
string insertCmd = "insert into Organizzatori (NomeUtente, Password, Nome, Cognome, IndirizzoPostaElettronica, Telefono) values ('eta' , 'eco' ,
'Antonioff' , 'ferfe' , 'po********@etantonio.it' , '333333')";
OleDbCommand myCommand = new OleDbCommand(insertCmd, OleDbconn);
myCommand.Connection.Open();
try
{
myCommand.ExecuteNonQuery();
}
catch (OleDbException ex)
{
lblMsg1.Text = ex.Message ;
}
myCommand.Connection.Close();

Can you help me to discover the problem, I'm using an Access DB.

Many thanks

Antonio D'Ottavio
Hi Antonio,
Have you checked the value types - e.g: is the '333333' a string or a

long value within database?

Sep 5 '05 #5
Antonio D'Ottavio wrote:
Good morning,
I've the following error
Syntax error in INSERT INTO statement
But I do not found any error in this code

OleDbconn = new OleDbConnection(sConnessioneDb);
string insertCmd = "insert into Organizzatori (NomeUtente, Password,
Nome, Cognome, IndirizzoPostaElettronica, Telefono) values ('eta' , 'eco' ,
'Antonioff' , 'ferfe' , 'p*********@etantonio.it' , '333333')";
OleDbCommand myCommand = new OleDbCommand(insertCmd, OleDbconn);
myCommand.Connection.Open();
try
{
myCommand.ExecuteNonQuery();
}
catch (OleDbException ex)
{
lblMsg1.Text = ex.Message ;
}
myCommand.Connection.Close();

Can you help me to discover the problem, I'm using an Access DB.

Many thanks

Antonio D'Ottavio

Antonio,

Have you tried using the .Net debugger to simply pick up your insertCmd string
at the point you are ready to send it and pasting it exactly as built into the
Access SQL window? Does that work? If not, your problem is indeed with the
syntax, not a .Net problem at all.

HTH,
-rick-
Sep 5 '05 #6
try removing the '@' in the email and see if it works. for grins.

"Antonio D'Ottavio" <po********@etantonio.it> wrote in message
news:eN**************@TK2MSFTNGP14.phx.gbl...
Good morning,
I've the following error
Syntax error in INSERT INTO statement
But I do not found any error in this code

OleDbconn = new OleDbConnection(sConnessioneDb);
string insertCmd = "insert into Organizzatori (NomeUtente, Password,
Nome, Cognome, IndirizzoPostaElettronica, Telefono) values ('eta' , 'eco'
,
'Antonioff' , 'ferfe' , 'po********@etantonio.it' , '333333')";
OleDbCommand myCommand = new OleDbCommand(insertCmd, OleDbconn);
myCommand.Connection.Open();
try
{
myCommand.ExecuteNonQuery();
}
catch (OleDbException ex)
{
lblMsg1.Text = ex.Message ;
}
myCommand.Connection.Close();

Can you help me to discover the problem, I'm using an Access DB.

Many thanks

Antonio D'Ottavio

Sep 5 '05 #7
You will be fighting with this block of code from now until the water's
pumped out of New Orleans if you don't convert it to a Parameter-based
Command. The Parameters handle the framing issues (some of which you have
not encountered yet) and other issues that you have seen.

hth

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

"Antonio D'Ottavio" <po********@etantonio.it> wrote in message
news:eN**************@TK2MSFTNGP14.phx.gbl...
Good morning,
I've the following error
Syntax error in INSERT INTO statement
But I do not found any error in this code

OleDbconn = new OleDbConnection(sConnessioneDb);
string insertCmd = "insert into Organizzatori (NomeUtente, Password,
Nome, Cognome, IndirizzoPostaElettronica, Telefono) values ('eta' , 'eco'
,
'Antonioff' , 'ferfe' , 'po********@etantonio.it' , '333333')";
OleDbCommand myCommand = new OleDbCommand(insertCmd, OleDbconn);
myCommand.Connection.Open();
try
{
myCommand.ExecuteNonQuery();
}
catch (OleDbException ex)
{
lblMsg1.Text = ex.Message ;
}
myCommand.Connection.Close();

Can you help me to discover the problem, I'm using an Access DB.

Many thanks

Antonio D'Ottavio

Sep 5 '05 #8

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

Similar topics

5
by: Arnab Nandi | last post by:
We are using the Sun Workshop 6 C++ compiler to compile some CPP files. The command line looks like follows: - CC -g -xsb -c -o output/x.o x.cpp We get the following error: - CC: language...
7
by: Antonio D'Ottavio | last post by:
Good morning, I've the following error Syntax error in INSERT INTO statement But I do not found any error in this code OleDbconn = new OleDbConnection(sConnessioneDb); string insertCmd =...
7
by: Arek | last post by:
Hey, I am inserting values in the table: Dim sqlcomm1 As SqlCommand = New SqlCommand("INSERT INTO tblTasks (idTask, outdate) VALUES ('" & IDTask.text & "','" & txtOutdate.Text & "')", conn)...
2
by: Manuel Canas | last post by:
Hi there, This is the Code ; cnSQL = New SqlConnection(ConnectionString) cmSQL = New SqlCommand(strSQL, cnSQL) strSQL = "INSERT tb_product VALUES(@ServiceCode,@ServiceName,@Price)" cmSQL =...
10
by: deathtospam | last post by:
My employer is starting to take the first steps towards migrating its Classic ASP codebase to ASP.NET v2.0. We have a copy of our existing website on the new Windows Server 2003 R2 test server,...
1
by: database | last post by:
I AM FACING A PROBLEM WHEN I ACCESS ONE OF THE PAGES. IT USED TO WORK BEFORE BUT AFTER RESTARTING THE APPLICATION SEVER IT GIVES THE FOLLOWING ERROR. - Server Error ...
6
by: reppisch | last post by:
Hi Ng, I have a multiset for keeping elements sorted in a container but key values may also be equal. Is there any guaranteed traversal order within the duplicate keys of a multimap? When...
2
by: aaron1234nz | last post by:
I am trying to insert new rows into a table but there are a few tricky things I have not been able to get my head around. 1. I need to insert a unique ID in each row. 2. I need to insert rows...
3
by: emlimeng | last post by:
hi everyone, I need help on an error message. I am working on an environment that Access2003 (adp) as a front end and links to SQL server as a back end. I am creating a table, which requests users...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

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.