Question Need some help in using the executeScalar()!!!

gautamshaw

New member
Joined
Aug 15, 2009
Messages
4
Programming Experience
Beginner
i want to compare a column present in the access database BankAccount table with a field present in the form named as account......
VB.NET:
cmd=new oledbCommand("Select CurrentBalance from BankAccount where BankName=@bankname and AccountNo=@accountno",con)
con.open()
cmd.Parameters.AddWithValue("@bankname", ComboBox1.Text)
cmd.Parameters.AddWithValue("@accountno", ComboBox2.Text)
Dim count As Decimal = cmd.ExecuteScalar()
con.close()
dim num1 as decimal
Decimal.TryParse(TextBox2.Text, num1)
if count < num1
msgbox("Transaction is not possible")
end if
Is this code correct or i should try something else?
Need some help!!!
 
Back
Top