Ciao a tutti e vi ringrazio in anticipo,
Problema: Sto facendo l'inserimento di dati in SQL SERVER 2005 in questo modo
*************************************************
*************************************************
Set cn = New Connection 'stabilisce una nuova connessione
cn.CursorLocation = adUseClient
cn.ConnectionString = "PROVIDER=SQLNCLI;SERVER=STEFANO-XP\STEFANO_XP;Database=GestioneRapportini;uid=sa;p wd=stefano;"
cn.Open
sSql = ""
sSql = sSql & "INSERT INTO Gest_rap(Data, Giorno, Tempo_impiegato, Percorrenza, " & vbCrLf 'faccio la select
sSql = sSql & "Altro, N_rapp, Scheda_lavoro, Fattura, Cliente, Tipo_lavoro, Classe_int, " & vbCrLf
sSql = sSql & "Descrizione, Note, id_ute)"
sSql = sSql & "VALUES ('" & txt_dat.Text & "', "
sSql = sSql & "'" & Cbo_gio.Text & "', "
sSql = sSql & "'" & txt_tem.Text & "', "
sSql = sSql & "'" & txt_per.Text & "', "
sSql = sSql & "'" & txt_alt.Text & "', "
sSql = sSql & "'" & txt_num.Text & "', "
sSql = sSql & "'" & txt_sch.Text & "', "
sSql = sSql & "'" & cbo_fat.Text & "', "
sSql = sSql & "'" & cbo_cli(0).Text & "', "
sSql = sSql & "'" & cbo_tip.Text & "', "
sSql = sSql & "'" & txt_cla.Text & "', "
sSql = sSql & "'" & txt_des.Text & "', "
sSql = sSql & "'" & txt_not.Text & "', "
sSql = sSql & "'" & ute & "') "
' INSERT INTO dirigenti(id, cognome, nome) VALUES(10, 'Corinzi', 'Mimmo')
Set rs = cn.Execute(sSql)
======= rs.close =======
************************************************** ****************
Se metto "rs.close" in fondo mi da errore L'OPERAZIONE NON E' CONSENTITA SE L OGGETTO E' CHIUSO.
Domanda: come faccio a chiudere la connessione una volta finita l'operazione?????? in che punto la devo mettere????
Grazie :=)

Rispondi quotando
