Im getting input for a price from a textbox and trying to put that into an SQL database. I keep getting this error.
Disallowed implicit conversion from data type varchar to data type money, table '424_A_04.dbo.Product', column 'Unit_price'. Use the CONVERT function to run this query. Disallowed implicit conversion from data type varchar to data type money, table '424_A_04.dbo.Product', column 'Purchase_price'. Use the CONVERT function to run this query.
Ive tried to run the conversion function to fix the problem but it doesnt seem to work.
What do I need to type in? Do I type the conversion directly into my SQL string that gets passed, or do I convert first and then insert the variable?
Here is what I currently have.
sql2 = "INSERT INTO Product (Product_no, Name, Description, Purchase_price, Unit_price, Qty_in_stock, Notes) VALUES ('" & ID & "', '" & pname & "','" & pdesc & "', '" & purprice & "', '" & unit & "', '" & qtystock & "', '" & note & "')"
Disallowed implicit conversion from data type varchar to data type money, table '424_A_04.dbo.Product', column 'Unit_price'. Use the CONVERT function to run this query. Disallowed implicit conversion from data type varchar to data type money, table '424_A_04.dbo.Product', column 'Purchase_price'. Use the CONVERT function to run this query.
Ive tried to run the conversion function to fix the problem but it doesnt seem to work.
What do I need to type in? Do I type the conversion directly into my SQL string that gets passed, or do I convert first and then insert the variable?
Here is what I currently have.
sql2 = "INSERT INTO Product (Product_no, Name, Description, Purchase_price, Unit_price, Qty_in_stock, Notes) VALUES ('" & ID & "', '" & pname & "','" & pdesc & "', '" & purprice & "', '" & unit & "', '" & qtystock & "', '" & note & "')"