codice:
Private Sub cmddelete_Click(sender as Object, e as EventArgs) Handles cmddelete.Click
Dim DeleteSQL as String
DeleteSQL= "DELETE clienti WHERE ID='" & lstclienti.SelectedItem.Value & "'"
Dim conn as New OleDbConnection()
conn.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=f:/Esercizi_ASPNET/Database/clienti.mdb"
dim cmd as New OleDbCommand(DeleteSQL, conn)
dim deleted as Integer ' lo devi dichiarare fuori dal try, perche
' se c'è un errore vieni rimandata al catch
' e quindi la variabile non è ancora stata
' dichiarata.
Try
conn.Open()
deleted=cmd.ExecuteNonQuery
Catch err as Exception
lblerr.Text = "ATTENZIONE: Errore nell'eliminazione dei records"
lblerr.Text &= err.Message
Finally
if (Not conn is Nothing) Then
conn.close()
end if
End try
if deleted > 0 then
Compilazione()
end if
End Sub
Cmq penso otterrai ancora errore, ma non so perchè.