Devo passare un numero da un TextBox (nel formato 1,2) ad una stringa SQL (nel formato 1.2)
Le impostazioni internazionali prevedono la virgola come separatore decimale, ma in questo caso il server sql si aspetta un numero (non stringa) con punto per separatore.
Avevo abbozzato questo codice, ma ovviamente non funziona...qualche suggerimento?
codice:Private Sub insert_article_Click() 'set decimal separator as point With Application .DecimalSeparator = "." .ThousandsSeparator = "," .UseSystemSeparators = False End With Dim number As Double Dim word As String word = "test" number = CDbl(Textnumber.Value) 'if I enter 1,2 ,number will be 1,2 'I try also this, but number will be 1,2 'number = Replace(Textnumber.Value, ".", ",") strSQL = "INSERT INTO table (col_word, col_number) VALUES ('" & word & "'," & number & ")" ... End Sub

Rispondi quotando