Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / July 2006

Tip: Looking for answers? Try searching our database.

SQL Query Syntax Error

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Deecrypt - 20 Jul 2006 11:37 GMT
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
Jamie Collins - 20 Jul 2006 11:53 GMT
> I am trying to insert the
> result
[quoted text clipped - 13 lines]
>                     insertAssessment.ExecuteNonQuery();
>                 }

Numeric values should not be in single quotes. Try:

                   string insertAssessmentData = "INSERT INTO
abdominalpainassessmentrecords (assessment_id, aap_key, concept_id,
attribute, value) VALUES (" + assessmentID + ", 1, 21522001,
363698007, " + painPresent + ")";

Jamie.

--
Deecrypt - 20 Jul 2006 18:10 GMT
Thank you, Problem solved.  although i also had to take out all the
field names too.  Seems does not like field names if the entire row is
going to be populated.

cheers

Khurram

> > I am trying to insert the
> > result
[quoted text clipped - 24 lines]
>
> --
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.