|
-
Aug 9th, 2000, 05:31 AM
#1
Thread Starter
Fanatic Member
I'm trying to create a table in Access via VB using ADO.
I keep getting the error message :
3251 - Object or provider is not capable of performing requested operation.
This is the code I'm using ...
Code:
Dim cat As New ADOX.Catalog
Dim tbl As New ADOX.Table
cat.ActiveConnection = conCrowd
With tbl
.Name = "TempTable"
.Columns.Append "Field1", adVarWChar
.Columns.Append "Field2", adVarWChar
.Columns.Append "Field3", adVarWChar
End With
cat.Tables.Append tbl
Set cat = Nothing
Can somebody tell me whats going on?
VB6 sp5, SQL Server 2000, C#
There are no stupid questions. Only stupid people. 
-
Aug 9th, 2000, 10:13 AM
#2
Hyperactive Member
ADOX ?
Stevie -
What library is ADOX ?
That's Mr Mullet to you, you mulletless wonder.
-
Aug 9th, 2000, 11:22 AM
#3
Guru
This works fine for me....I'm using the Jet 4.0 provider with an Access 2000 DB, but you're probably using 3.51......(which is probably why it won't work for you)
Code:
Dim objCn As ADODB.Connection
Dim objCat As ADOX.Catalog
Dim objTbl As ADOX.Table
Set objCat = New ADOX.Catalog
Set objCn = New ADODB.Connection
Set objTbl = New Table
objCn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Nwind2k.mdb"
objCat.ActiveConnection = objCn
With objTbl
.Name = "TempTable"
.Columns.Append "Field1", adVarWChar
.Columns.Append "Field2", adVarWChar
.Columns.Append "Field3", adVarWChar
End With
objCat.Tables.Append objTbl
Set objCat = Nothing
-
Aug 9th, 2000, 01:22 PM
#4
it is a little easier with sql, try it...
db.Execute "CREATE TABLE MyTable " _
& "(Field1 TEXT(50) , Field2 TEXT(50) , " _
& "Field3 TEXT(50));"
-
Aug 10th, 2000, 03:46 AM
#5
Thread Starter
Fanatic Member
Cheers for all the answers, I wasn't in work yesterday afternoon so I didn't get to see all the replies.
In the end I did it with a SQL statement instead of with ADO much like the Larryn's answer.
Thanks again.
VB6 sp5, SQL Server 2000, C#
There are no stupid questions. Only stupid people. 
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
|