|
-
May 29th, 2011, 11:45 PM
#1
Thread Starter
Junior Member
Regarding date problem
hi guys
the code is
db.database= update usr bb_rh='" & text2.text & "',b_sh='" & text3.text & "',date=#" & text4.text & ",s_rn='" & text5.text "'where tno=" & text1.text & please do needfull to this query
regards
Satish.S
-
May 30th, 2011, 12:14 AM
#2
Re: Regarding date problem
I find it much easier to construct a String containing the SQL Query because if there's a syntax error it's a simple matter of printing the String to the Immediate Window so you can see the actual query that will be presented to the parser.
In your case there appears to be more than one error. Because you've just re-typed the code, rather than using copy and paste, and you haven't said what the error actually is, it's difficult to comment. However, in the code you have posted, you're missing the SET instruction, and there's a # missing after Text4.Text.
Try this and if it doesn't work, tell us what the error is, copy and paste your actual code into the post together with the contents of the Immediate Window.
Code:
Dim strSQL As String
strSQL = "UPDATE usr SET "
strSQL = strSQL & "bb_rh=" & Text2.Text & ","
strSQL = strSQL & "b_sh='" & Text3.Text & "',"
strSQL = strSQL & "date=#" & Text4.Text & "#,"
strSQL = strSQL & "s_m='" & Text5.Text & "'"
strSQL = strSQL & " WHERE tno=" & Text1.Text
Debug.Print strSQL
db.Execute strSQL
This assumes that in the usr Table definition:
bb_rh is a Number
b_sh is Text
date is Date
s_m is Text
tno is a Number
As you gain more experience in Database accessing and using SQL you may like to read up on Stored Procedures and perhaps use them as opposed to 'in-line' SQL.
Last edited by Doogle; May 30th, 2011 at 12:18 AM.
-
May 30th, 2011, 07:02 AM
#3
Re: Regarding date problem
Thread moved to 'Database Development' forum (the 'VB6' forum is only meant for questions which don't fit in more specific forums)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|