Hi all!!
I need your help.... i'm working since 2 hours on a simple insert statement,
but couldn't handle it.
Here is my code :
public int ExecQuery(string SqlString)
{
OleDbConnection oCoon = new OleDbConnection(connectionString);
oCoon.Open();
OleDbCommand cmd3 = new OleDbCommand();
cmd3.Connection = oCoon;
cmd3.CommandText = SqlString;
if(oCoon.State == ConnectionState.Closed)
{
oCoon.Open();
}
cmd3.ExecuteNonQuery();
return 1
}
When the code reach the cmd3.ExecuteNonQuery(); I always receive the
followin error :
SYNTAX ERROR IN INSERT INTO STATEMENT....
But, i tried to put some debug info (Debug.Write) and my SQL statement seem
ok.
SQL Statement : INSERT INTO COLORS (agent_no,primary,secondary) VALUES
(3,'fff','ALLO')
Any idea??
Thanks, 2 1581
primary is a reserved word. Put this instead [primary]
"eric dugal" <er********@videotron.ca> wrote in message
news:d8**********************@wagner.videotron.net ... Hi all!!
I need your help.... i'm working since 2 hours on a simple insert
statement, but couldn't handle it.
Here is my code :
public int ExecQuery(string SqlString)
{
OleDbConnection oCoon = new OleDbConnection(connectionString);
oCoon.Open();
OleDbCommand cmd3 = new OleDbCommand();
cmd3.Connection = oCoon;
cmd3.CommandText = SqlString;
if(oCoon.State == ConnectionState.Closed)
{
oCoon.Open();
}
cmd3.ExecuteNonQuery();
return 1
} When the code reach the cmd3.ExecuteNonQuery(); I always receive the followin error :
SYNTAX ERROR IN INSERT INTO STATEMENT....
But, i tried to put some debug info (Debug.Write) and my SQL statement
seem ok. SQL Statement : INSERT INTO COLORS (agent_no,primary,secondary) VALUES (3,'fff','ALLO') Any idea??
Thanks,
Thanks, that was the problem!!
"William Gower" <w_*****@hotmail.com> a écrit dans le message de
news:%2****************@TK2MSFTNGP12.phx.gbl... primary is a reserved word. Put this instead [primary]
"eric dugal" <er********@videotron.ca> wrote in message news:d8**********************@wagner.videotron.net ... Hi all!!
I need your help.... i'm working since 2 hours on a simple insert statement, but couldn't handle it.
Here is my code :
public int ExecQuery(string SqlString)
{
OleDbConnection oCoon = new OleDbConnection(connectionString);
oCoon.Open();
OleDbCommand cmd3 = new OleDbCommand();
cmd3.Connection = oCoon;
cmd3.CommandText = SqlString;
if(oCoon.State == ConnectionState.Closed)
{
oCoon.Open();
}
cmd3.ExecuteNonQuery();
return 1
} When the code reach the cmd3.ExecuteNonQuery(); I always receive the followin error :
SYNTAX ERROR IN INSERT INTO STATEMENT....
But, i tried to put some debug info (Debug.Write) and my SQL statement seem ok. SQL Statement : INSERT INTO COLORS (agent_no,primary,secondary) VALUES (3,'fff','ALLO') Any idea??
Thanks,
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Gérard Leclercq |
last post by:
ACCESS
First fields are TEXT, last 2 are Numbers
The name of the fields are correct.
Dim MyConn
Set MyConn=Server.CreateObject("ADODB.Connection")
MyConn.Open...
|
by: dcarson |
last post by:
I've read about this error in several other discussions, but still
can't seem to pinpoint the problem with my code. Everything seemed to
be working fine for some time, but it now tends to bomb out...
|
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
|
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...
|
by: Neil Zanella |
last post by:
Hello,
I am trying to execute ADO.NET INSERT statement where one of the
fields
is coming from a password HTML control. When I access the text with
password.Value and print with Response.Write...
|
by: Nathan Sokalski |
last post by:
When trying to submit data to an Access database using ASP.NET I recieve the
following error:
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr)
+41...
|
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:...
|
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...
|
by: ewpatton |
last post by:
Good day,
I've been trying to work with SQL and an Access database in order to
handle custom user profiles. I haven't had any trouble reading from my
database, but inserting new entries into...
|
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...
|
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...
|
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,...
|
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$) {
}
...
|
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...
|
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
|
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: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
| |