Hallo zusammen,
ich verzweifel an mir gerade selbst.
Das Datenbank Feld in der accdb ist Doube bei den spez_gew.
Hier möchte ich ein Updae machen. Volle Zahlen gehen.
bei Konveriterung von Single auf text gab es keine Problem nur bei Double.
Ich will einfach von einen Text Feld wo der Wert in Koma einegebn wird z.B.
0,78 in die DB Schaufeln wo das DB feld Double ist. Hat jemand eine kleine Idee?
Was habe ich schon alles gemacht?
diese drei Varianten habe ich getetstet
Dim spez_gew As Double = CType(txt_spez_gew.Text, Double)
Dim spez_gew As Double = Val(txt_spez_gew.Text.Replace(",", "."))
Dim spez_gew as Double = Cdbl(txt_spez_gew.Text)
ich verzweifel an mir gerade selbst.
Das Datenbank Feld in der accdb ist Doube bei den spez_gew.
Hier möchte ich ein Updae machen. Volle Zahlen gehen.
bei Konveriterung von Single auf text gab es keine Problem nur bei Double.
Ich will einfach von einen Text Feld wo der Wert in Koma einegebn wird z.B.
0,78 in die DB Schaufeln wo das DB feld Double ist. Hat jemand eine kleine Idee?
Was habe ich schon alles gemacht?
diese drei Varianten habe ich getetstet
Dim spez_gew As Double = CType(txt_spez_gew.Text, Double)
Dim spez_gew As Double = Val(txt_spez_gew.Text.Replace(",", "."))
Dim spez_gew as Double = Cdbl(txt_spez_gew.Text)
VB.NET-Quellcode
- Private Sub cmd_speichern_Click(sender As Object, e As EventArgs) Handles cmd_speichern.Click
- Dim DB As String
- 'Var fuer Datenbank
- Dim con As New OleDbConnection
- Dim cmd As New OleDbCommand
- 'Variable bei Formular deklarieren
- 'Datenbank Test
- DB = "C:\DB\"
- Dim datum_von As Date
- Dim tag_von As String
- Dim mon_von As String
- Dim jahr_von As String
- Dim datum_bis As Date
- Dim tag_bis As String
- Dim mon_bis As String
- Dim jahr_bis As String
- Dim Ergebnis As Integer
- Dim Ergebnis2 As Integer
- datum_von = DateTP_von.Value
- tag_von = datum_von.ToString("dd")
- mon_von = datum_von.ToString("MM")
- jahr_von = datum_von.ToString("yyyy")
- datum_bis = DateTP_bis.Value
- tag_bis = datum_bis.ToString("dd")
- mon_bis = datum_bis.ToString("MM")
- jahr_bis = datum_bis.ToString("yyyy")
- Dim produkt As Integer
- ' Dim spez_gew As Double = CType(txt_spez_gew.Text, Double)
- Dim spez_gew As Double = Val(txt_spez_gew.Text.Replace(",", "."))
- produkt = 103
- Select Case MsgBox("Wollen sie Daten die dbminas ==> tabepreis ", MsgBoxStyle.YesNo, "caption")
- Case MsgBoxResult.Yes
- con.ConnectionString =
- "Provider=Microsoft.ACE.OLEDB.12.0;" &
- "Data Source=" & DB & "dbminas.accdb"
- cmd.Connection = con
- cmd.CommandText = "Update tabepreis Set spez_gew = " & spez_gew &
- " where (monat between " & CInt(mon_von) & " and " & CInt(mon_bis) & ") and (tag between " & CInt(tag_von) & " And " & CInt(tag_bis) &
- ") And (jahr between " & CInt(jahr_von) & " and " & CInt(jahr_bis) & ") And (produkt = " & CInt(produkt) & ")"
- Try
- con.Open()
- Ergebnis = cmd.ExecuteNonQuery()
- MsgBox("Es wurde " & Ergebnis & " x Preise geändert.")
- Catch ex As Exception
- MessageBox.Show(ex.Message)
- End Try
- con.Close()
- Case MsgBoxResult.No
- Exit Sub
- End Select