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 > Delphi, C etc > Alter Table

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-26-02, 21:43
Muddy Muddy is offline
Registered User
 
Join Date: Jun 2002
Posts: 1
Alter Table

Why do I get "Syntax Error in ALTER statement" for the following? I am using VB6 and msjet4.0

conn.Execute "ALTER TABLE Table1 RENAME field1 TO field2"

I also tried this to no avail:

conn.Execute "ALTER TABLE Table1 RENAME COLUMN field1 TO field2"

I can execute DROP and ADD with ALTER TABLE with no problem, but get the same error when using MOVE with ALTER TABLE.

Any help greatly appreciated!
Reply With Quote
  #2 (permalink)  
Old 06-29-02, 22:18
rnealejr rnealejr is offline
Registered User
 
Join Date: Feb 2002
Posts: 2,232
Try using the adox reference - Microsoft ADO Extensions for DDL and Security in your vb6 code.

The following is a code extraction using the northwind database:

Dim col As ADOX.Column
Dim cn As ADODB.Connection
Dim cat As ADOX.Catalog
Dim tbl As ADOX.Table

Set cn = New ADODB.Connection

cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files\Microsoft Visual Studio\VB98\NWIND.MDB;Persist Security Info=False"
cn.Open
Set cat = New ADOX.Catalog
cat.ActiveConnection = cn
Set tbl = cat("customers")
Set col = tbl("Region")
col.Name = "Region1"
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On