Errors Reading excel file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • netcomp
    New Member
    • Jan 2009
    • 2

    Errors Reading excel file

    Hi there, first time poster...long time lurker ;-)

    Not sure why but I get errors when I add the 'where' clause to my select statement. Any ideads why this is happening - been researching for hours...

    here's a snippet of the code:

    Code:
    oNoun = Request.Form("noun")
    response.Write(oNoun)
    
    strSelect = "Select modifier from [sheet1$] "
    'strSelect = strSelect & " where noun = " & oNoun
    
    
    Set oConnDICT = Server.CreateObject("ADODB.Connection")
    oConnDICT.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
                   "Data Source=" & Session("dict_full_path_name") & ";" & _
                   "Extended Properties=""Excel 8.0;HDR=YES;"""
    Dim oRSDICT
    Set oRSDICT = Server.CreateObject("ADODB.Recordset")
    oRSDICT.Open strSelect, oConnDICT
    
    If Not oRSDICT.EOF then
    	arroRSDICT = oRSDICT.GetRows()
    End If
  • jhardman
    Recognized Expert Specialist
    • Jan 2007
    • 3405

    #2
    Just an observation, you have written the query as if the noun column contains a number. If that is correct, then it should work. If the noun column should contain other data, a string for example, then the clause should end as follows:
    Code:
    strSelect = strSelect & " where noun = '" & oNoun & "'"
    Let me know if this helps.

    Jared

    Comment

    • netcomp
      New Member
      • Jan 2009
      • 2

      #3
      You are exactly correct Jared. I found it about two minutes after I posted my question and forgot to update the thread.

      Thanx for taking the time.

      Comment

      Working...