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
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


0