-
February 17th, 2013, 02:08 AM
#1
Update DB Using VB 6.0
Hello Guys, I need Your help.. Because my Code not Working,, VB 6.0 Says: Type Mismatch.
Code:
Private Sub Command3_Click()
Dim update As Integer
update = "UPDATE [ProductInfo] SET Price = '" & txtPrice.Text & "' , Quantity= '" & txtQty.Text & "' where BarCode= '" & txtBarCode.Text & "'"
acd.Execute update
MsgBox "Product Updated"
End Sub
-
February 17th, 2013, 02:48 AM
#2
Re: Update DB Using VB 6.0
Are your database fields defined as text or numeric? Fields like price and qty one would think would be numeric or should be anyway.
If they are then you have another error which has not yet popped up .... syntax error in query expression. 's are used around Text fields but not used for Numeric fields.
As to your error you have defined update as Integer but are trying to use it as a string which causes a type mismatch... i.e. You are trying to put one type of data in a variable which you have told VB should be getting a different type of data so the types do not match. Change your dim to the correct type and that error will go away.
Always use [code][/code] tags when posting code.
Tags for this Thread
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
|