M
Mika M
Lets say I need to do something like this when running sql-sentences...
Private Sub InsertIntoTable(ByVal ProductID As Integer, ByVal Amount As
Single)
Dim sql as String = String.Format("INSERT INTO MyTable (ProductID,
Amount) VALUES ({0}, {1})", ProductID, Amount)
'...code continues...
End Sub
....in this case problem will be "Amount"- Single type variable, because
for example here in Finland our Decimal symbol is , (= comma) not . (=
point).
If amount is one and half (1.5) then our form is 1,5 and it's not
correct form for sql-sentences directly - so what's the recommended way
for these to convert into correct form? I have handled single numbers
like this way...
Dim strAmount As Single = Amount.ToString.Replace(",", ".")
....and then used strAmount like...
Dim sql as String = String.Format("INSERT INTO MyTable (ProductID,
Amount) VALUES ({0}, {1})", ProductID, strAmount)
....but I assume it's not good to do it like this way
Private Sub InsertIntoTable(ByVal ProductID As Integer, ByVal Amount As
Single)
Dim sql as String = String.Format("INSERT INTO MyTable (ProductID,
Amount) VALUES ({0}, {1})", ProductID, Amount)
'...code continues...
End Sub
....in this case problem will be "Amount"- Single type variable, because
for example here in Finland our Decimal symbol is , (= comma) not . (=
point).
If amount is one and half (1.5) then our form is 1,5 and it's not
correct form for sql-sentences directly - so what's the recommended way
for these to convert into correct form? I have handled single numbers
like this way...
Dim strAmount As Single = Amount.ToString.Replace(",", ".")
....and then used strAmount like...
Dim sql as String = String.Format("INSERT INTO MyTable (ProductID,
Amount) VALUES ({0}, {1})", ProductID, strAmount)
....but I assume it's not good to do it like this way
