I want SQL query to retrieve data

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • poojadeepak
    New Member
    • Dec 2007
    • 6

    I want SQL query to retrieve data

    Hello.
    I am making a VB application with Access database in backend. I can feed data from datagrid control to database. But I have a problem while retrieving data.
    The code used is
    [CODE=vb] With comSupplier
    .ActiveConnecti on = conSupplier
    .CommandText = "INSERT INTO temp1 SELECT Sr_No,Bill_Date ,Vend_code,Roun d FROM PRHD0801 WHERE Bill_Date =" & strName
    .Execute
    End With[/CODE]
    While debugging I get value of strName but problem while executing.
    Please give me any idea.
    Last edited by Killer42; Dec 29 '07, 01:32 PM.
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    If you are trying to retrieve records, why are you using the INSERT command?
    Last edited by Killer42; Dec 29 '07, 02:19 PM.

    Comment

    • poojadeepak
      New Member
      • Dec 2007
      • 6

      #3
      Originally posted by debasisdas
      If you are trying to retrieve records, why are you using the INSERT command?
      I have a table with details record. I am using blank temp for filling data ,send the data from temp to detail & delete data from temp.When I am trying to retrive data I want to transfer data from detail to temp which satifies the condition
      After that I can see the data from temp.The problem is in inserting.
      Last edited by Killer42; Dec 29 '07, 02:19 PM.

      Comment

      • Killer42
        Recognized Expert Expert
        • Oct 2006
        • 8429

        #4
        Well I must say, your WHERE clause looks very questionable. Are you sure that's the correct field (Bill_Date) and variable (strName)?

        And regardless of the answer to the above, have you considered the issue of delimiters? Unless it's a numeric field it will need some sort of delimiters around the value. Are they already present in variable strName?

        Comment

        Working...