Visual Basic - Problema con Visual Basic 6 y SQL Server 2000

Life is soft - evento anual de software empresarial
 
Vista:

Problema con Visual Basic 6 y SQL Server 2000

Publicado por Juan Manuel (1 intervención) el 20/09/2006 16:37:15
Buenos dias, les comento mi problema:
Tengo que ejecutar un consulta de update desde una aplicacion visual basic a un servidor sql 2000 y el depurador pasa por la instruccion sin tirar ningun error pero resulta que el registro sigue igual que antes.
Probe de dos formas diferentes:

Public Sub OpenDB()
On Error Resume Next
Set cn = New ADODB.Connection
cn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=callbusiness;Data Source=DATACENTER"
cn.Open
If Err.Number <> 0 Then
MsgBox "No se pudo abrir la base de datos " & Err.Description
End
End If
End Sub

1º)
Private cmdcodigotira As New ADODB.Command
Private cmdcontactos As New ADODB.Command

dni = Text1(1).Text

cmdcodigotira.CommandText = "UPDATE codigo_tira " _
& "SET amex_tira='" & Text1(2).Text & "', amex_codigo='" & Text1(3).Text & "', amex_ed='" & Text1(4).Text & "', " _
& "hsbc_tira='" & Text1(5).Text & "', hsbc_codigo='" & Text1(6).Text & "', hsbc_ed='" & Text1(7).Text & "', " _
& "bpi_tira='" & Text1(8).Text & "', bpi_codigo='" & Text1(9).Text & "', bpi_ed='" & Text1(10).Text & "', " _
& "WHERE doc_nro='" & dni & "'"

cmdcontactos.CommandText = "UPDATE contactos " _
& "SET cont_pretel1='" & Text2(0).Text & "', cont_tel1='" & Text2(1).Text & "', " _
& "cont_pretel2='" & Text2(2).Text & "', cont_tel2='" & Text2(3).Text & "', " _
& "cont_pretel3='" & Text2(4).Text & "', cont_tel3='" & Text2(5).Text & "', " _
& "cont_pretel4='" & Text2(6).Text & "', cont_tel4='" & Text2(7).Text & "', " _
& "cont_preeq1='" & Text2(8).Text & "', cont_teleq1='" & Text2(9).Text & "', " _
& "cont_preeq2='" & Text2(10).Text & "', cont_teleq2='" & Text2(11).Text & "', " _
& "cont_preeq3='" & Text2(12).Text & "', cont_teleq3='" & Text2(13).Text & "', " _
& "cont_preeq4='" & Text2(14).Text & "', cont_teleq4='" & Text2(15).Text & "', " _
& "WHERE doc_nro='" & dni & "'"

cmdcodigotira.CommandType = adCmdText
cmdcontactos.CommandType = adCmdText

cmdcodigotira.Execute
cmdcontactos.Execute

2º)
Dim modi_CODIGO_TIRA As String
Dim modi_CONTACTOS As String

modi_CODIGO_TIRA = "UPDATE codigo_tira " _
& "SET amex_tira='" & Text1(2).Text & "', amex_codigo='" & Text1(3).Text & "', amex_ed='" & Text1(4).Text & "', " _
& "hsbc_tira='" & Text1(5).Text & "', hsbc_codigo='" & Text1(6).Text & "', hsbc_ed='" & Text1(7).Text & "', " _
& "bpi_tira='" & Text1(8).Text & "', bpi_codigo='" & Text1(9).Text & "', bpi_ed='" & Text1(10).Text & "', " _
& "WHERE doc_nro='" & dni & "'"

modi_CONTACTOS = "UPDATE contactos " _
& "SET cont_pretel1='" & Text2(0).Text & "', cont_tel1='" & Text2(1).Text & "', " _
& "cont_pretel2='" & Text2(2).Text & "', cont_tel2='" & Text2(3).Text & "', " _
& "cont_pretel3='" & Text2(4).Text & "', cont_tel3='" & Text2(5).Text & "', " _
& "cont_pretel4='" & Text2(6).Text & "', cont_tel4='" & Text2(7).Text & "', " _
& "cont_preeq1='" & Text2(8).Text & "', cont_teleq1='" & Text2(9).Text & "', " _
& "cont_preeq2='" & Text2(10).Text & "', cont_teleq2='" & Text2(11).Text & "', " _
& "cont_preeq3='" & Text2(12).Text & "', cont_teleq3='" & Text2(13).Text & "', " _
& "cont_preeq4='" & Text2(14).Text & "', cont_teleq4='" & Text2(15).Text & "', " _
& "WHERE doc_nro='" & dni & "'"

cn.Execute (modi_CODIGO_TIRA)
cn.Execute (modi_CONTACTOS)

Agradecere cualquier ayuda.

saludos
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Problema con Visual Basic 6 y SQL Server 2000

Publicado por csdk (127 intervenciones) el 22/09/2006 22:55:45
esto en un modulo
Public Function conex()
ADOCONN.ConnectionString = " Provider=SQLOLEDB.1;Persist Security Info=False;User ID=SA;Initial Catalog=mibase;Data Source=server"
ADOCONN.Open
End Function
Public Function desconectar()
ADOCONN.Close
End Function
conex

RST_NIVEL.Source = "Update tb_empleado set nombre_COMPLETO = '" & Txt_Nombre.Text & "', curp ='" & Txt_Curp.Text & "',RFC='" & Txt_Rfc.Text & "',cvl_nivel=" & CVL_N & ",cvl_seccion=" & CVL_S & ",puesto='" & Cbo_Puesto.Text & "' WHERE cvl_empleado ='" & txt_AcEm.Text & "'"
RST_NIVEL.ActiveConnection = ADOCONN
RST_NIVEL.Open
MsgBox ("El registro se a modificado")

Txt_CvlEmpleado.Text = ""
Txt_CvlEmpleado.Visible = False
Txt_CvlEmpleado.Enabled = False

desconectar
para numeros= "& 1 & "
para casdenas='"& cadena & "'
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar