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

SQL Query Syntax Error

Hi,
I hope Im posting in the right newsgroup. I am trying to insert the
result
of the below SQL query in my Access 2003 table. All the fields in this
table
are of type Number. I'm picking up the value of a dropdownlist box and

insert the relevant values in one row of the table.

if (painPresentComboBox.Text == "RUQ")
{
int painPresent = 301717006;
string assessmentID = assessmentNoTextBox.Text;
Convert.ToInt32(assessmentID);
string insertAssessmentData = "INSERT INTO
abdominalpainassessmentrecords (assessment_id, aap_key, concept_id,
attribute, value) VALUES ('" + assessmentID + "', '1', '21522001',
'363698007', '" + painPresent + "')";

OleDbCommand insertAssessment = new
OleDbCommand(insertAssessmentData, o);
insertAssessment.ExecuteNonQuery();
}
Please Help. Desperate beyond belief
Khurram

Jul 20 '06 #1
2 1271
If these are all "number" type, why are you inserting strings? You might
want to start by removing the quotes around the values you're inserting.

Steve
"Deecrypt" <kn*****@gmail.comwrote in message
news:11**********************@m79g2000cwm.googlegr oups.com...
Hi,
I hope Im posting in the right newsgroup. I am trying to insert the
result
of the below SQL query in my Access 2003 table. All the fields in this
table
are of type Number. I'm picking up the value of a dropdownlist box and

insert the relevant values in one row of the table.

if (painPresentComboBox.Text == "RUQ")
{
int painPresent = 301717006;
string assessmentID = assessmentNoTextBox.Text;
Convert.ToInt32(assessmentID);
string insertAssessmentData = "INSERT INTO
abdominalpainassessmentrecords (assessment_id, aap_key, concept_id,
attribute, value) VALUES ('" + assessmentID + "', '1', '21522001',
'363698007', '" + painPresent + "')";

OleDbCommand insertAssessment = new
OleDbCommand(insertAssessmentData, o);
insertAssessment.ExecuteNonQuery();
}
Please Help. Desperate beyond belief
Khurram

Jul 20 '06 #2
Thank you Steve,

Problem solved. although i also had to take out all the field names
too. Seems Access 2003 does not like field names if the entire row is
going to be populated.

cheers

Khurram

Steve Barnett wrote:
If these are all "number" type, why are you inserting strings? You might
want to start by removing the quotes around the values you're inserting.

Steve
"Deecrypt" <kn*****@gmail.comwrote in message
news:11**********************@m79g2000cwm.googlegr oups.com...
Hi,
I hope Im posting in the right newsgroup. I am trying to insert the
result
of the below SQL query in my Access 2003 table. All the fields in this
table
are of type Number. I'm picking up the value of a dropdownlist box and

insert the relevant values in one row of the table.

if (painPresentComboBox.Text == "RUQ")
{
int painPresent = 301717006;
string assessmentID = assessmentNoTextBox.Text;
Convert.ToInt32(assessmentID);
string insertAssessmentData = "INSERT INTO
abdominalpainassessmentrecords (assessment_id, aap_key, concept_id,
attribute, value) VALUES ('" + assessmentID + "', '1', '21522001',
'363698007', '" + painPresent + "')";

OleDbCommand insertAssessment = new
OleDbCommand(insertAssessmentData, o);
insertAssessment.ExecuteNonQuery();
}
Please Help. Desperate beyond belief
Khurram
Jul 20 '06 #3

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

Similar topics

3
by: joemyre | last post by:
Hi everyone, What I'm trying to do is take php variables i got from user input, and pass them as the MySQL query terms. $query = "select * from ident where ".$searchtype1."=".$searchterm1."";...
29
by: shank | last post by:
1) I'm getting this error: Syntax error (missing operator) in query expression on the below statement. Can I get some advice. 2) I searched ASPFAQ and came up blank. Where can find the "rules"...
1
by: Dalan | last post by:
I can't seem to find a workaround of Query Syntax Error. Actually, the query performs just fine, except when the last record on a related subform is deleted, then it generates a Runtime Error 3075...
1
by: Dalan | last post by:
I'm experiencing a Query Syntax Error with an Access 97 Db. Actually, the query performs as expected when adding any new records or editing existing ones and even deleting records, EXCEPT when the...
3
by: KevLow | last post by:
Hi, Hope some kind soul can help me out here.. I'm trying to programmatically modify the column headings of a crosstab query such that it can be dynamic based on user specified period (Month...
7
by: John Øllgård Jensen | last post by:
Hi Using MS Asccess 2000: In a query I'm trying to create a new field with following expression: FilmDate: Left(,4) The field "FilmNo" is another text field in the query. This is...
9
by: Kelii | last post by:
I've been trying to get this piece to work for a few hours, but have given up. I hope someone out there can help, I think the issue is relatively straightforward, but being a novice, I'm stumped....
7
by: bryant | last post by:
Hi all. I am new to ASP and working in Expression Web. The following query displays the information I need in the gridview for a single record. SELECT "OE_HDR"."ORD_NO", "OE_HDR"."CUST_NAM",...
2
by: dvelst | last post by:
Hi All, I have the following query which was based on a working query in MySQL: (don't be afraid of the size of the query you see below, later on I will concentrate on part of this query) ...
7
by: Yesurbius | last post by:
I am receiving the following error when attempting to run my query. In my mind - this error should not be happening - its a straight-forward query with a subquery. I am using Access 2003 with all...
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:
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...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...

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.