I have the following code
String query = "INSERT INTO Product (ProductCode, Range, Type, Size, Description, Cost, Barcode) VALUE ('" + txbx_ProductCode.Text + "', '" + txbx_Range.Text + "','" +
txbx_Type.Text + "' , '" + txbx_Size.Text + "', '" + txbx_Description.Text + "' , '" + decimal.Parse(txbx_Cost.Text) + "' , '" + txbx_Barcode.Text + "')";
I get the following FormatException on this line: FormatException Image
I suspect there is an issue with me parsing the .text. I've tried parsing to float, double, Decimal and decimal. It's the same on all cases.
The values entered are between 20000.00 and 100.00 always having 2 decimals so they never exceed the smallmoney value.
Firstly thank you to E.J. Brennan and Ian Kemp for putting me on the right path. I don't know how to add a commendation or whatever it is called on StackOverflow but thank you.
I ended up adding everything into prepared statements and got a few errors but they were different to the one I got earlier and easier to squash.
The new method looks like this:
PS. Sorry for all the commenting, I just like knowing at a glance whats what.
And yes, "for the love of all that's holy, use prepared statements".