11-03-2010, 11:58 AM
The above statements only tell me how to connect and fetch data from DB, here is my script
Code:
Set Con = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")
Con.Open "Provider=SQLOLEDB;DBDatasource=XXXX;Database=master;Integrated Security = SSPI;DBOracle=false"
Con.Open connectionstring
SQL="Create Database XYZ" --- the database XYZ gets created successfully
rs.open SQL, Con
Con.Close
Con.Open "Provider=SQLOLEDB;DBDatasource=XYZ;Database=XYZ;Integrated Security = SSPI;DBOracle=false;VNETClassLibrary=Standard"
SQL = "Create Login <username> WITH PASSWORD = <'password'> , DEFAULT_DATABASE = XYZ " --- the user gets created for database XYZ, however when verified in SQL Management studio the user is not mapped with the database
rs.open SQL, Con
Con.Close