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. Delete Command - By Parameter - Problem()

Delete Command - By Parameter - Problem()

Scheduled Pinned Locked Moved Visual Basic
databasehelptutorialquestion
4 Posts 2 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.
  • P Offline
    P Offline
    Paramu1973
    wrote on last edited by
    #1

    I have a Dataadapter, by select query. During datasave, getting problem with delete command.It's not working. I need to delete the null values. So how to pass the parameters? Dim Save_3 As String = "Delete from gnlmst where gnl_code is null" DAD.DeleteCommand = New SqlCommand(Save_3, con) With DAD.DeleteCommand.Parameters .Add("@???????", SqlDbType.VarChar, 0, "gnl_code") End With Thanks:thumbsup:

    R 1 Reply Last reply
    0
    • P Paramu1973

      I have a Dataadapter, by select query. During datasave, getting problem with delete command.It's not working. I need to delete the null values. So how to pass the parameters? Dim Save_3 As String = "Delete from gnlmst where gnl_code is null" DAD.DeleteCommand = New SqlCommand(Save_3, con) With DAD.DeleteCommand.Parameters .Add("@???????", SqlDbType.VarChar, 0, "gnl_code") End With Thanks:thumbsup:

      R Offline
      R Offline
      Rupesh Kumar Swami
      wrote on last edited by
      #2

      Paramu1973 wrote:

      Dim Save_3 As String = "Delete from gnlmst where gnl_code is null"

      whether you try like following Dim Save_3 As String = "Delete from gnlmst where @gnl_code is NULL" DAD.DeleteCommand = New SqlCommand(Save_3, con) With DAD.DeleteCommand.Parameters Add("@gnl_code", SqlDbType.VarChar, 50).Value = "gnl_code" End With

      rup28aug@yahoo.co.in Rupesh Kumar Swami Software Developer, Integrated Solution, Bikaner (India) My Company Award: Best VB.NET article of June 2008: Create Column Charts Using OWC11

      P 1 Reply Last reply
      0
      • R Rupesh Kumar Swami

        Paramu1973 wrote:

        Dim Save_3 As String = "Delete from gnlmst where gnl_code is null"

        whether you try like following Dim Save_3 As String = "Delete from gnlmst where @gnl_code is NULL" DAD.DeleteCommand = New SqlCommand(Save_3, con) With DAD.DeleteCommand.Parameters Add("@gnl_code", SqlDbType.VarChar, 50).Value = "gnl_code" End With

        rup28aug@yahoo.co.in Rupesh Kumar Swami Software Developer, Integrated Solution, Bikaner (India) My Company Award: Best VB.NET article of June 2008: Create Column Charts Using OWC11

        P Offline
        P Offline
        Paramu1973
        wrote on last edited by
        #3

        Thanks. :) Tried. But It's Not Deleting.

        R 1 Reply Last reply
        0
        • P Paramu1973

          Thanks. :) Tried. But It's Not Deleting.

          R Offline
          R Offline
          Rupesh Kumar Swami
          wrote on last edited by
          #4

          try following Dim QueryText As String dim fieldName as string ="Field1" Dim command As System.Data.SqlClient.SqlCommand = New System.Data.SqlClient.SqlCommand() QueryText ="delete from table where @field is NULL" command.CommandText = QueryText command.Parameters.Add("@field", SqlDbType.Varchar, fieldName.length).Value = fieldName

          rup28aug@yahoo.co.in Rupesh Kumar Swami Software Developer, Integrated Solution, Bikaner (India) My Company Award: Best VB.NET article of June 2008: Create Column Charts Using OWC11

          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