Answer» I'm trying to create an Access database using SQL. I'm very new at this language, in fact have never created a database through a script or SQL before. The error I'm getting says:
Error Type: Microsoft VBScript compilation (0x800A0401) Expected end of statement /InternetProgrammingIIDocs/Practice/Chapter 22/Accounting.asp, LINE 10, column 16 CREATE DATABASE Accounting -----------------^
Here is my entire code below:
<%@ Language=VBScript %>
Accounting
<% CREATE DATABASE Accounting ON (FILE = Accounting, FILENAME = G:\Internet Programming II\Practice\Chapter 22\Accounting.mdb, SIZE = 10, MAXSIZE = 50, FILEGROWTH = 5) LOG ON (FILE = AccountingLog FILENAME = G:\Internet Programming II\Practice\Chapter 22\Accounting.ldb, SIZE = 5MB, MAXSIZE = 25MB, FILEGROWTH = 5MB) GO %>
According to EVERY source I've viewed on the net, you simple create a database by using the words CREATE DATABASE , but my browser says it's wrong. Is there some KIND of dll or something I'm suppose to include before using SQL statements? I feel something is being missed.
NickCreating a database via SQL. Hmm....
You are doing it a very different WAY to how I do, but this is how I would do it
Code: [SELECT]<%
' Initialise the variables
dim dbConnection ' Database connection dim strSQL ' SQL Query
' Connect to the database
set dbConnection = Server.CreateObject("ADODB.Connection") dbConnection.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("../database.mdb")
' Perform the SQL action
strSQL = "SQL COMMAND GOES HERE" dbConnection.Execute strSQL
' Close the connection
dbConnection.Close
%> Information on SQL can be found at http://www.w3schools.com/sql
|