DeleteCommand problem..
-
Hello, I've problem with the sqlDataAdapter.DeleteCommand. When I Insert or Update data there are no problem.. but when I delete data, there is no error but nothing happend in the database.. Here is the code.. 'select no problem :-D cmdSelect = Database.CreateCommand("cContact_SelectAllByVehicle") cmdSelect.CommandType = CommandType.StoredProcedure cmdSelect.Parameters.Add("@ID_Vehicle", 1) sqlDaClient.SelectCommand = cmdSelect 'delete dosent'work :(( cmdDelete = Database.CreateCommand("delete from cContact WHERE ID_Contact = @ID_Contact and ID_Vehicle = @ID_Vehicle") cmdDelete.CommandType = CommandType.Text cmdDelete.Parameters.Add(New SqlParameter("@ID_Contact", SqlDbType.Decimal, 0, "ID_Contact")) cmdDelete.Parameters.Add(New SqlParameter("@ID_Vehicle", 1)) sqlDaClient.DeleteCommand = cmdDelete 'insert no problem :-D cmdInsert = Database.CreateCommand("insert into cContact(ID_Vehicle, ID_Contact, Rate) values(@ID_Vehicle, @ID_Contact, @Rate)") cmdInsert.CommandType = CommandType.Text cmdInsert.Parameters.Add(New SqlParameter("@ID_Vehicle", 1)) cmdInsert.Parameters.Add(New SqlParameter("@ID_Contact", SqlDbType.Decimal, 0, "ID_Contact")) cmdInsert.Parameters.Add(New SqlParameter("@Rate", SqlDbType.Float, 0, "Rate")) sqlDaClient.InsertCommand = cmdInsert 'update no problem :-D cmdUpdate = Database.CreateCommand("UPDATE cContact SET Rate = @Rate WHERE ID_Contact = @ID_Contact and ID_Vehicle = @ID_Vehicle") cmdUpdate.CommandType = CommandType.Text cmdUpdate.Parameters.Add(New SqlParameter("@ID_Contact", SqlDbType.Decimal, 0, "ID_Contact")) cmdUpdate.Parameters.Add(New SqlParameter("@ID_Vehicle", 1)) cmdUpdate.Parameters.Add(New SqlParameter("@Rate", SqlDbType.Decimal, 0, "Rate")) sqlDaClient.UpdateCommand = cmdUpdate sqlDaClient.Fill(dtClient) dtClient.Rows.RemoveAt(0) sqlDaClient.Update(dtClient) I really need some help.. thanks.. Julien