Results 1 to 2 of 2

Thread: VB and DB2

  1. #1
    Join Date
    Aug 2010

    Unanswered: VB and DB2

    Hi every one . I'm beginner in VB . I want to delete a column in my DataBase(DB2) , and write this command for delete

    Dim conn As DB2Connection = New DB2Connection("database=tut8;UID=;PWD=")
    Dim myCommand As New DB2Command
    Dim sql1 As String
    sql1 = "delete from student where id = ('" & TextBox1.Text & "')"
    myCommand.Connection = conn
    myCommand.CommandText = sql1

    my problem this when i want to delete this command, just delete last row that i enter with command insert

  2. #2
    Join Date
    Jun 2004
    Arizona, USA
    the SQL DELETE command deletes rows, not columns. To remove a column, you will need to use the SQL ALTER TABLE DROP COLUMN xxxxx statement.

    In looking at the documentation, it isn't clear if you are allowed to drop columns in DB2. If not, you'll need to create a new table without the offending column, populate the new table with data from the existing table, then kill the old table, and rename the new table with the old table name.
    Last edited by loquin; 09-03-10 at 02:58.
    "Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
    "I have my standards. They may be low, but I have them!" - Bette Middler
    "It's a book about a Spanish guy named Manual. You should read it." - Dilbert

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts