Run command: Input string was not in a correct format

Hi,

I am trying to insert data into an sql database,

This is the design

image

this is how I parameterized it,

however this is the error i’m encountering

image

My query:

Please can you assist on how I can go about sorting this out.

Helo @Aki1111
Try this

 "INSERT INTO [dbo].[t1] ([invoice_no],[subtotal],[vat], [total])VALUES("+invoice_no+","+subtotal+","+vat+","+total+")"

hi,

This does not work.

I have a problem with the double variable query.

@Aki1111 Print the Log message whether the Double values are not empty and ensure that it is number.

it is just that I dont know how to send a float data type to database that is the reason for me get a run command error. Please see the title for the error.

@Aki1111 ,

Does this work if there are no double values to be added and only the string value ?

Could you also check when you do this operation manually if it is able to add the data ?

No it doesn’t

Its able to add the data manually.

Try CDBL(string) instead of Convert.ToDouble(string).
And also make sure the string is a valid number.

@Aki1111 ,
That would mean you were not able to add only the invoice_no value as well alone. Can you also provide us with the Expression that was used ?