D
David Fúnez
Hi;
My problem is updating 2 fields of a record, the code #1 works ok, but the
code #2 fails.
What i want is to UPDATE 5 values.
Thanks on advance
(A)
' Table Clientes Schema
cmd.CommandText = "CREATE TABLE Clientes (" & _
"Id_cliente nchar(5) NOT NULL PRIMARY KEY, " & _
"Nombre nchar(20), " & _
"Contacto nchar(20), " & _
"Direccion nvarchar(20), " & _
"Telefono nchar(8), " & _
"Activo bit)"
(B)
' Here i pass the textboxes values
Dim cId, cNom, cCont, cTel, cDir As String
Dim cAct As Boolean
cId = Me.txtIdCte.Text
cNom = Me.txtNombre.Text
cCont = Me.txtContacto.Text
cTel = Me.txtTelefono.Text
cDir = Me.txtDireccion.Text
cAct = Me.txtActivo.Text
#1
' This Update code works Ok with one field
cmd.CommandText = _
"UPDATE clientes SET nombre=" & cNom & " WHERE id_cliente=" & cId
#2
' This code doesn't work Updating 2 fields
cmd.CommandText = _
"UPDATE clientes SET nombre=" & cNom & _
", contacto=" & cCont & _
" WHERE id_cliente=" & cId
My problem is updating 2 fields of a record, the code #1 works ok, but the
code #2 fails.
What i want is to UPDATE 5 values.
Thanks on advance
(A)
' Table Clientes Schema
cmd.CommandText = "CREATE TABLE Clientes (" & _
"Id_cliente nchar(5) NOT NULL PRIMARY KEY, " & _
"Nombre nchar(20), " & _
"Contacto nchar(20), " & _
"Direccion nvarchar(20), " & _
"Telefono nchar(8), " & _
"Activo bit)"
(B)
' Here i pass the textboxes values
Dim cId, cNom, cCont, cTel, cDir As String
Dim cAct As Boolean
cId = Me.txtIdCte.Text
cNom = Me.txtNombre.Text
cCont = Me.txtContacto.Text
cTel = Me.txtTelefono.Text
cDir = Me.txtDireccion.Text
cAct = Me.txtActivo.Text
#1
' This Update code works Ok with one field
cmd.CommandText = _
"UPDATE clientes SET nombre=" & cNom & " WHERE id_cliente=" & cId
#2
' This code doesn't work Updating 2 fields
cmd.CommandText = _
"UPDATE clientes SET nombre=" & cNom & _
", contacto=" & cCont & _
" WHERE id_cliente=" & cId