Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. DeleteCommand problem..

DeleteCommand problem..

Scheduled Pinned Locked Moved Visual Basic
helpdatabaseannouncement
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    GJul
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups