aiutatemi a risolvere questo problea.
codice:function Query(ByVal codice as string) as string return "DELETE FROM Prodotti WHERE Codice='"& codice &"'" end function sub MyDataGrid_Delete(Sender As Object, E As DataGridCommandEventArgs) Dim objCmd As New OleDbCommand(Query(MyDataGrid.DataKeys(E.Item.ItemIndex)),objConn) ' try objConn.Open objCmd.ExecuteNonQuery() lblmessage.text="CANCELLATO" ' catch ex as exception ' lblmessage.text="ERRORE" ' end try objConn.Close MyDataGrid.databind() end sub
cosi com'è ricevo questo errore:
Impossibile eliminare dalle tabelle specificate.
Descrizione: Eccezione non gestita durante l'esecuzione della richiesta Web corrente. Per ulteriori informazioni sull'errore e sul suo punto di origine nel codice, vedere l'analisi dello stack.
Dettagli eccezione: System.Data.OleDb.OleDbException: Impossibile eliminare dalle tabelle specificate.
Errore nel codice sorgente:
Riga 61: ' try
Riga 62: objConn.Open
Riga 63: objCmd.ExecuteNonQuery()
Riga 64: lblmessage.text="CANCELLATO"
Riga 65: ' catch ex as exception
![]()
![]()

Rispondi quotando