codice:
Dim Ogg As New ADODB.Command
Dim Cns As New ADODB.Connection
With Cns
.ConnectionString = DataConnessione 'str di conn. al DB
.CursorLocation = adUseClient ' tipo di cursore
.Mode = adModeShareDenyNone ' nessuna limitazione
.CommandTimeout = 15
.Open
End With
Ogg.ActiveConnection = Cns
Ogg.CommandType = adCmdText
' Prima di salvare Elimina i vecchi records dalla tabella - TblAnagraficaCL:
Ogg.CommandText = "Delete * From TblAnagraficaCL"
Ogg.Execute
Ogg.CommandText = "insert into TblAnagraficaCL(Titolo, Nome, Cognome, CodiceFiscale, TipoVia, Via, NCivico, Cap, Citta, Provincia, Telefono, Cellulare, Fax, Email, NomeFile)" _
& "values ('" & Replace(FrmAnagCliente.CmbCl1.Text, "'", "''") & "', '" & Replace(FrmAnagCliente.TxtCt1.Text, "'", "''") & "', '" & Replace(FrmAnagCliente.TxtCt2.Text, "'", "''") _
& "', '" & Replace(FrmAnagCliente.TxtCt3.Text, "'", "''") & "', '" & Replace(FrmAnagCliente.CmbCl2.Text, "'", "''") & "' ,'" & Replace(FrmAnagCliente.TxtCt4.Text, "'", "''") _
& "', '" & Replace(FrmAnagCliente.TxtCt5.Text, "'", "''") & "', '" & Replace(FrmAnagCliente.TxtCt6.Text, "'", "''") & "' ,'" & Replace(FrmAnagCliente.TxtCt7.Text, "'", "''") _
& "', '" & Replace(FrmAnagCliente.CmbCl3.Text, "'", "''") & "', '" & Replace(FrmAnagCliente.TxtCt8.Text, "'", "''") & "' ,'" & Replace(FrmAnagCliente.TxtCt9.Text, "'", "''") _
& "', '" & Replace(FrmAnagCliente.TxtCt10.Text, "'", "''") & "', '" & Replace(FrmAnagCliente.TxtCt11.Text, "'", "''") & "' ,'" & Replace(FrmAnagCliente.LblCli12.Caption, "'", "''") & "');"
Ogg.Execute
' Chiude la connessione:
Cns.Close
Set Cns = Nothing
Spero che possa servirti.