|
-
Sep 13th, 2000, 05:10 AM
#1
Hi there , can anyone tell me how I can rename an access
table trough oledb.
I always get an error.
I've tried
Dim strSQL As String
Dim m_conn As New ADODB.Connection
Set m_conn = New ADODB.Connection
m_conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Players.mdb;Persist Security Info=False"
m_conn.CursorLocation = adUseClient
m_conn.Open 'CardPlay
strSQL = "RENAME OLDPLAYER TO NewPlayer"
m_conn.Execute strSQL
Set m_conn = Nothing
error raised:Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or 'UPDATE'.
i've tried some other statements but all raising error
of error in sql statement;
Can anyone help me with a right statement?
-
Sep 13th, 2000, 07:35 AM
#2
Lively Member
use the tabledef
Set myTableDefs = myDB.TableDefs
myTableDefs(i).Name = myMssString
this will rename a table
-
Sep 13th, 2000, 07:51 AM
#3
Hoi Swatty,
I've never used them before, but have a look at the following statements : ( Jet SQL version 3.0 )
Good luck.
----------------------------------------------------------
CREATE TABLE table (field1 type [(size)] [NOT NULL] [index1]
[, field2 type [(size)] [NOT NULL] [index2] [, ...]]
[, CONSTRAINT multifieldindex [, ...]])
The CREATE TABLE statement is used to create a new table and its fields. At its simplest you can create a table containing only a single field by specifying the name you want to give the table, the field name and the type of data you want the field to contain:
CREATE TABLE Names (Name TEXT);
--------------------------------------------------
DROP {TABLE table | INDEX index ON table}
The DROP statement can be used to delete an existing index from a table...
DROP INDEX UniqueValues ON Names;
...or delete an entire table from a database.
-
Sep 13th, 2000, 07:53 AM
#4
I can't use a plein Database cause with W2000
the .mdb files are no longer recognized I get the following error.
'3343 Unrecognizable database format'
So I can't use you're good answer.
I'm trying to let the SQL statement change the tablename.
Alltough I'm not sure this is possible with Access mdb files.
Anyone else there who can help me ?
-
Sep 13th, 2000, 07:59 AM
#5
Works very fine GUUS but,
I have to rename an existing table wich is no longer needed
but may not be dropped.
So I can create a new table with the previous name of the renamed one.
To let further executes of my program communicate with the newly created table.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|