If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Visual Basic > VB and DB2

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-24-10, 16:50
calamaris calamaris is offline
Registered User
 
Join Date: Aug 2010
Posts: 21
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 & "')"
conn.Open()
myCommand.Connection = conn
myCommand.CommandText = sql1
myCommand.ExecuteNonQuery()
conn.Close()

my problem this when i want to delete this command, just delete last row that i enter with command insert
Reply With Quote
  #2 (permalink)  
Old 09-03-10, 01:47
loquin loquin is offline
Super Moderator
 
Join Date: Jun 2004
Location: Arizona, USA
Posts: 1,797
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.
__________________
Lou
使大吃一惊
"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


Last edited by loquin; 09-03-10 at 01:58.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On