By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,986 Members | 1,537 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,986 IT Pros & Developers. It's quick & easy.

I want SQL query to retrieve data

P: 6
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
Expand|Select|Wrap|Line Numbers
  1.   With comSupplier
  2.  .ActiveConnection = conSupplier
  3.  .CommandText = "INSERT INTO temp1 SELECT   Sr_No,Bill_Date,Vend_code,Round FROM PRHD0801 WHERE Bill_Date =" & strName
  4.  .Execute
  5. End With
While debugging I get value of strName but problem while executing.
Please give me any idea.
Dec 22 '07 #1
Share this Question
Share on Google+
3 Replies


debasisdas
Expert 5K+
P: 8,127
If you are trying to retrieve records, why are you using the INSERT command?
Dec 22 '07 #2

P: 6
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.
Dec 22 '07 #3

Expert 5K+
P: 8,434
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?
Dec 29 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.