| Bug #15041 | Cast from string "INSERT INTO table_name" to type 'Double' is not valid | ||
|---|---|---|---|
| Submitted: | 18 Nov 2005 3:05 | Modified: | 20 Nov 2005 8:30 |
| Reporter: | Reginald Fewell | Email Updates: | |
| Status: | Not a Bug | Impact on me: | |
| Category: | Connector / NET | Severity: | S3 (Non-critical) |
| Version: | 5.0 | OS: | Windows (Windows XP) |
| Assigned to: | Vasily Kishkin | CPU Architecture: | Any |
[20 Nov 2005 8:30]
Vasily Kishkin
You need to replace "+" on "&" :
from:
Dim myInsertQuery As String = "INSERT INTO transactions Values
('" + transacdate + "', '" + firstn + "', '" + lastn + "','" + middle + "', '" +
phone + "', '" + transaction_total + "', '" + taxdeduct + "')"
to:
Dim myInsertQuery As String = "INSERT INTO transactions Values
('" & transacdate & "', '" & firstn & "', '" & lastn & "','" & middle & "', '" &
phone & "', '" & transaction_total & "', '" & taxdeduct & "')"
It is sintax VB error.
[27 May 2010 6:32]
axel caceres
gracias me fue de mcuha utilidad

Description: I have the following VB.Net code to insert a record into MySQL and get the error listed below: Dim transaction_total As Double Dim taxdeduct As Double transacdate = Today lastn = Me.editLast_Name.Text firstn = Me.editFirst__Name.Text middle = Me.editMiddle_Initial.Text phone = Me.editPhone_Number.Text transaction_total = FormatCurrency(Total) taxdeduct = FormatCurrency((uniform * Val(txtUniforms.Text))) Dim myConnection As New MySqlConnection(myConnectionString) Dim myInsertQuery As String = "INSERT INTO transactions Values ('" + transacdate + "', '" + firstn + "', '" + lastn + "','" + middle + "', '" + phone + "', '" + transaction_total + "', '" + taxdeduct + "')" Dim myCommand As New MySqlCommand(myInsertQuery) myCommand.Connection = myConnection myConnection.Open() myCommand.ExecuteNonQuery() myCommand.Connection.Close() ERROR:(Cast from string "INSERT INTO transactions Values " to type 'Double' is not valid.) It appears that the Insert statement will not accept the type double. Please advise if you all can help. How to repeat: Copy the VB.NET code above and execute.