Hi,
suppose this code in a .hta file:
sql = readFile("query.sql");
var cnstr="Provider=SQLOLEDB;Data
Source="+sqlServer+";uid="+user+";pwd="+pass+";";
cn = new ActiveXObject("ADODB.Connection");
cn.open(cnstr)
cn.execute(sql);
cn.close();
delete cn;
readfile is a function that opens the .sql file and reads the query data.
example of a .sql file:
CREATE DATABASE [myDataBase]
GO
USE [myDataBase]
GO
CREATE TABLE [dbo].[s1] (
[ModuleID] [int] IDENTITY (0, 1) NOT NULL ,
[TabID] [int] NOT NULL ,
) ON [PRIMARY]
GO
when i call this code in the .hta file, I get the following error: incorrect
syntax near 'GO'
if I do not use GO, then the database is not created and I get an error at
the USE statement...
How can I execute this script ?
--
................................................
Mihai Cristian Bocai
http://www.inwww.ltd.uk
................................................