-
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 ????
-
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)