M
Marc
Hi
a strange problem, probably a bug in vbnet i think,
Working with vbnet visualStudio 2005
Windows forms, controls textboxes (not a datagridview)
Working mith the same query
Update works fine in SqlConnection
BUT fails with OleDbConnection specialy if there are amty textboxes
Am I doing something wrong or is this a bug!! how to work around
Sub UpdateData
IntAdresId = CInt(Me.txtAdresID.Text)
Dim strSQL As String = "UPDATE tblAdressen " & _
" SET Naam = '" & Me.txtNaam.Text.ToString & "' ," & _
" Straat = '" & Me.txtStraat.Text.ToString & "' ," & _
" Postcode= '" & Me.cboPostcode.Text.ToString & "' ," & _
" Plaats = '" & Me.cboPlaats.Text.ToString & "' ," & _
" Land = '" & Me.cboLand.Text.ToString & "' ," & _
" Landcode ='" & Me.txtLandcode.Text.ToString & "'," & _
" BtwNr = '" & Me.txtBtwNr.Text.ToString & "'," & _
" BtwCode= '" & Me.txtBtwCode.Text.ToString & "'," & _
" Tel1 = '" & Me.txtTel1.Text.ToString & "'," & _
" Gsm = '" & Me.txtGsm.Text.ToString & "'," & _
" Fax = '" & Me.txtFax.Text.ToString & "'," & _
" Url = '" & Me.txtUrl.Text.ToString & "' ," & _
" Korting = " & intKorting.ToString & " ," & _
" Toelichting = '" & Me.txtToelichting.Text.ToString & "' ,"
& _
" Activiteit = '" & Me.txtActiviteit.Text.ToString & "' ," &
_
" LocMap = '" & Me.txtLocMap.Text.ToString & "' ," & _
" BetaalTerm = " & Me.cboBetaalterm.Text.ToString & " ," & _
" Email = '" & Me.txtEmail.Text & "'" & _
" WHERE tblAdressen.AdresID = " & IntAdresId.ToString
'= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
= = = =
'*** IF WORKING WIT MSSQL EXPRESS AS BACKEND
Dim objConn As New SqlConnection(strConnString)
objConn.Open()
' Console.WriteLine(sSQL)
Dim objCmd As New SqlCommand(strSQL, objConn)
objCmd.ExecuteNonQuery()
objConn.Close()
'*** IF WORKING WITH MSACCESS AS BACKEND
Dim objConn As New OleDbConnection(strConnString)
objConn.Open()
Dim objCmd As New OleDbCommand(strSQL, objConn)
objCmd.ExecuteNonQuery()
objConn.Close()
End Sub
Many thanks in advance,
Marc.
a strange problem, probably a bug in vbnet i think,
Working with vbnet visualStudio 2005
Windows forms, controls textboxes (not a datagridview)
Working mith the same query
Update works fine in SqlConnection
BUT fails with OleDbConnection specialy if there are amty textboxes
Am I doing something wrong or is this a bug!! how to work around
Sub UpdateData
IntAdresId = CInt(Me.txtAdresID.Text)
Dim strSQL As String = "UPDATE tblAdressen " & _
" SET Naam = '" & Me.txtNaam.Text.ToString & "' ," & _
" Straat = '" & Me.txtStraat.Text.ToString & "' ," & _
" Postcode= '" & Me.cboPostcode.Text.ToString & "' ," & _
" Plaats = '" & Me.cboPlaats.Text.ToString & "' ," & _
" Land = '" & Me.cboLand.Text.ToString & "' ," & _
" Landcode ='" & Me.txtLandcode.Text.ToString & "'," & _
" BtwNr = '" & Me.txtBtwNr.Text.ToString & "'," & _
" BtwCode= '" & Me.txtBtwCode.Text.ToString & "'," & _
" Tel1 = '" & Me.txtTel1.Text.ToString & "'," & _
" Gsm = '" & Me.txtGsm.Text.ToString & "'," & _
" Fax = '" & Me.txtFax.Text.ToString & "'," & _
" Url = '" & Me.txtUrl.Text.ToString & "' ," & _
" Korting = " & intKorting.ToString & " ," & _
" Toelichting = '" & Me.txtToelichting.Text.ToString & "' ,"
& _
" Activiteit = '" & Me.txtActiviteit.Text.ToString & "' ," &
_
" LocMap = '" & Me.txtLocMap.Text.ToString & "' ," & _
" BetaalTerm = " & Me.cboBetaalterm.Text.ToString & " ," & _
" Email = '" & Me.txtEmail.Text & "'" & _
" WHERE tblAdressen.AdresID = " & IntAdresId.ToString
'= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
= = = =
'*** IF WORKING WIT MSSQL EXPRESS AS BACKEND
Dim objConn As New SqlConnection(strConnString)
objConn.Open()
' Console.WriteLine(sSQL)
Dim objCmd As New SqlCommand(strSQL, objConn)
objCmd.ExecuteNonQuery()
objConn.Close()
'*** IF WORKING WITH MSACCESS AS BACKEND
Dim objConn As New OleDbConnection(strConnString)
objConn.Open()
Dim objCmd As New OleDbCommand(strSQL, objConn)
objCmd.ExecuteNonQuery()
objConn.Close()
End Sub
Many thanks in advance,
Marc.