How to create database using vbscript code?
Please tell me how to create database in sql server using vbscript code? And where we have to write the code?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Nilanka DharmadasaPosted Nov 7, 2009, 2:41 AM
You can write this in your script to connect to your SQL server DB.
Const adOpenStatic = 3
Const adLockOptimistic = 3
Set objConnection = CreateObject("ADODB.Connection")
Set objRecordSet = CreateObject("ADODB.Recordset")
objConnection.Open _
objConn.Open "Driver={SQL Server};" & _
"Server=YourServer\DatabaseInstance;" & _
"Database=DatabaseName;" & _
"user id=username;" & _
"password=password;"
objRecordSet.Open "SELECT * FROM Customers", _
objConnection, adOpenStatic, adLockOptimistic
objRecordSet.MoveFirst
If this helps you please accept my answer...