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
Printable View
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
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.
This assumes that in the usr Table definition: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
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.
Thread moved to 'Database Development' forum (the 'VB6' forum is only meant for questions which don't fit in more specific forums)