Insert Double value via SQL to database
Posted on 2012-03-28
I am using vb.net and access 2010 database.
I am using an insert statement to send a double value from a grid-view cell to an access database.
The cell contains a double value.
The problem is i am able to send the values with a decimal next to every number which has two zeros following it:
10.00 , 25.00 , 100.00 (i.e. when i input a number with the decimal point and the following numbers with two consecutive zeros, there is no problem in sending the values to the database using the sql.)
but when i put in any number other than the two zeros after the decimal point such as 10.12, 10.52, 52.41, then i get the following error from the try catch block.
number of query values and destination fields are not the same
this is the way i am using the sql:
dim dblCashIn as double
sql = insert into tblBank (cashInCome) values (dblCashIn);
and i use the executenonquery command to insert the data into the database.
Thanks in advance.