datatype mismatch error

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Sep 2008
Posts: 7
Reputation: onlyvidya is an unknown quantity at this point 
Solved Threads: 0
onlyvidya onlyvidya is offline Offline
Newbie Poster

datatype mismatch error

 
0
  #1
Nov 7th, 2008
Hi frnds,,
i hv a form in which i want to calculate balance.I wrote code for this as follows.
But its giving me an error as "Datatype mismatch error". I hv declared bal & amt in database as Currency.Is this proper??If not suggest me some other code plzzzz.
what datatype should I specify for these two variables??
Dim bal, amt As Integer
If (cmbtrans.SelectedItem = "DEPOSIT") Then
bal = 0
amt = Val(txtamt.Text)
bal = bal + amt
txtbalance.Text = bal

End If
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 8
Reputation: ksanthoshmail is an unknown quantity at this point 
Solved Threads: 0
ksanthoshmail ksanthoshmail is offline Offline
Newbie Poster

Re: datatype mismatch error

 
0
  #2
Nov 7th, 2008
Originally Posted by onlyvidya View Post
Hi frnds,,
i hv a form in which i want to calculate balance.I wrote code for this as follows.
But its giving me an error as "Datatype mismatch error". I hv declared bal & amt in database as Currency.Is this proper??If not suggest me some other code plzzzz.
what datatype should I specify for these two variables??
Dim bal, amt As Integer
If (cmbtrans.SelectedItem = "DEPOSIT") Then
bal = 0
amt = Val(txtamt.Text)
bal = bal + amt
txtbalance.Text = bal

End If

re:
Better You can Use Double
i.e
Dim bal, amt as Double

Because amount are having decimal values.
like 0.00

and also change database Datatype to money or float(in sqlserver2000)
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 144
Reputation: sierrainfo is an unknown quantity at this point 
Solved Threads: 9
sierrainfo sierrainfo is offline Offline
Junior Poster

Re: datatype mismatch error

 
0
  #3
Nov 18th, 2008
You can Use Double

Dim bal, amt as Double ' like 0.00

If you are using MS Access Database not need to change Currency Datatype
or using SQL Server 2000 in database change Datatype to money or float.

Regards
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the VB.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC