View Single Post
  #1 (permalink)  
Old April 30th, 2004, 06:24 PM
nidy_online nidy_online is offline
Registered User
 
Join Date: Apr 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Syntax error (missing operator) in query expressio

This is part of the code. Error "Syntax error (missing operator) in query expression" is coming in the mentioned error line . When i am trying to print the value retrieved by the query its right. Even the other similar queries are working . I dont understand whats wrong with string 'strgc'. Please help.
In other part of code, same problem sometimes come with strfa,strec also but sometimes it works fine. Please help.


Dim get1 As New OleDbCommand(query1, myconnection)
                myreader = get1.ExecuteReader()
                While (myreader.Read())
                    rownew("RecordID") = myreader(0)
                    rownew("FundAgencyID") = myreader(1)
                    rownew("EngineeringID") = myreader(2)
                    rownew("GeotechCoID") = myreader(3)
                    rownew("DrillingCoID") = myreader(4)
                    rownew("ProjectNameID") = myreader(5)
                    rownew("HoleID") = myreader(6)
                    rownew("ReportNo") = myreader(7)
                    rownew("ContractNo") = myreader(8)
                    rownew("GeofileNo") = myreader(9)
                    rownew("DrillFileNo") = myreader(10)
                    rownew("BridgeNo") = myreader(11)
                    strfa = "Select [o.Name] from ORGANISATIONNAME o, BOREHOLEDATASOURCE bds where o.OrgID=bds.FundAgencyID and o.OrgCatID=2 and bds.FundAgencyID=" & myreader(1)
                    strec = "Select o.Name from ORGANISATIONNAME o, BOREHOLEDATASOURCE bds where o.OrgID = bds.EngineeringID and o.OrgCatID=3 and bds.EngineeringID=" & myreader(2)
                    strgc = "Select o.Name from ORGANISATIONNAME o, BOREHOLEDATASOURCE bds where o.OrgID = bds.GeotechCoID and o.OrgCatID=4 and bds.GeotechCoID=" & myreader(3)
                    'Response.Write("Value is" & strgc)
                    'Response.End()
                    strdc = "Select o.Name from ORGANISATIONNAME o, BOREHOLEDATASOURCE bds where o.OrgID = bds.DrillingCoID and o.OrgCatID=5 and bds.DrillingCoID=" & myreader(4)
                    strpn = "Select pu.ProjectName from PROJECTNAMELOOKUP pu, BOREHOLEDATASOURCE bds where pu.ProjectNameID = bds.ProjectNameID and bds.ProjectNameID=" & myreader(5)
                End While


 Dim comgc As New OleDbCommand(strgc, myconnection)
             'error line
**** myreader1 = comgc.ExecuteReader()***
                While (myreader1.Read())
                    gname = myreader1(0) & ""
                    'Response.Write(gname)
                    'Response.End()
                End While
                myreader1.Close()

Reply With Quote