I have read the article with the VB code to create an articles of the Access database, write very well.
Write down the method of creating a SQL database according to the idea for your reference.
1: Quote ADO2.5LIB
2: Add a button on the form Command1
3: Button code is as follows:
PRIVATE SUB Command1_Click () DIM CNN AS New Adodb.connection 'Defines New Connection DIM RS AS NEW AdoDB.Recordset' Defines New Record Set DIM STRSQL AS String 'Defines Database Connection Strings Strsql = "Provider = SQLOLOLDB.1; PERSIST Security Info = False; User ID = sa; Initial Catalog = master; Data Source = (local) " 'MASTER database connected firstly cnn.Open strsqlstrsql =" create database text1 "' to create the database TEXT1rs.Open strsql, cnn, adOpenStatic, adLockReadOnlycnn .Close 'Close connection Master is the connection set cnn = nothing' release connection
strsql = "provider = SQLOLDB.1; PERSIST security info = false; user ID = sa; initial catalog = text1; data source = (local)" repositioning connection database cnn.open strsql 'open connection strsql = "CREATE TABLE TEXT1 (a varchar (50)) "Create Table and Field RS.Open Strsql, CNN, AdoPenStatic, AdlockReadonlymsgbox" OK "end SUB
Personal opinions, welcome to exchange
QQ: 32416070