|
-
August 18th, 1999, 10:14 AM
#1
ADO
Hi,
I want to overwrite a table MyTable. I tried:
cmd.CommandText = "Drop Table MyTable"
--> All it does is delete all the data, but the table is still there
Then I try create MyTable again
cmd.CammandText = "Create MyTable col1 char(10) "
----> ERROR MyTable already exist ????
-
August 19th, 1999, 04:31 AM
#2
Re: ADO
We tried the following code in VB and having sqlserver 7.0 as backend , its working perfectly.
Public MyConn As ADODB.Connection
Set MyConn = New ADODB.Connection
ConnStr = "Provider=sqloledb;Driver={SQL Server};Server=" & <Your ServerName> & ";Initial Catalog=" & <Your Database Name> & ";User ID=sa;password=;"
MyConn.ConnectionString = ConnStr
Dim cmd As New ADODB.Command
Set cmd.ActiveConnection = MyConn
cmd.CommandText = "Drop table MyTable"
cmd.Execute
cmd.CommandText = "create table MyTable(MyCol varchar(10))"
cmd.Execute
The Ultimate Solution Providers
Authors
Sriman & Jayaraman
Email : [email protected]
[email protected]
Hand Phone : +(6) 016 2237147 (Malaysia)
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
|