1 <!-- #INCLUDE FILE = "../../plugins/asp/dbClass3.vbs" -->
\r
4 ' ***********************************************************
\r
5 ' This is where the database connection settings go.
\r
6 ' The ASP and .net LiveGrid examples should run without changes on Windows - accessing the examples\data\Northwind.mdb database by default.
\r
7 ' As your application develops, this would also be a logical place to put security checks.
\r
8 ' ***********************************************************
\r
11 Dim oDB,oForm,accessRights,appDB
\r
12 const appName="Northwind"
\r
16 Function CreateDbClass()
\r
17 Set oDB = new dbClass
\r
20 ' ***********************************************************
\r
21 ' UNCOMMENT THE APPROPRIATE LINE FOR YOUR DATABASE
\r
22 ' IF ALL ARE COMMENTED, SQL SERVER (TSQL) WILL BE THE DEFAULT
\r
24 'oDB.SqlSvr="myserver" ' put your server name here (if not localhost)
\r
25 'oDB.SqlSvr="mbrown27"
\r
26 oDB.Use_Access Server.Mappath("../data/northwind.mdb")
\r
27 'oDB.Use_Oracle "XE"
\r
29 ' ***********************************************************
\r
36 select case oDB.Dialect
\r
37 case "TSQL" : OpenDB=oDB.SqlLogon(appDB, "edituser", "password")
\r
38 'case "TSQL" : OpenDB=oDB.SqlLogon(appDB, "userid", "password")
\r
39 case "Access": OpenDB=oDB.SqlLogon(empty, "Admin", "")
\r
40 case "Oracle": OpenDB=oDB.SqlLogon(empty, "NORTHWIND", "Password")
\r
41 case "MySQL" : OpenDB=oDB.SqlLogon(appDB, "UserID", "Password")
\r
46 function OpenApp(title)
\r
48 if not OpenDB then exit function
\r
49 if not IsEmpty(title) then AppHeader appName & "-" & title
\r
50 accessRights="rw" ' CHECK APPLICATION SECURITY HERE (in this example, "r" gives read-only access and "rw" gives read/write access)
\r
51 if IsEmpty(accessRights) or IsNull(accessRights) or left(accessRights,1)<>"r" then
\r
52 response.write "<p class='error'>You do not have permission to access this application"
\r
59 function OpenTableEdit(tabname)
\r
60 set obj=new TableEditClass
\r
61 obj.SetTableName tabname
\r
62 obj.options("XMLprovider")="ricoQuery.asp"
\r
63 set OpenTableEdit=obj
\r
67 function OpenGridForm(title,tabname)
\r
70 if not OpenApp(title) then exit function
\r
71 set oForm=OpenTableEdit(tabname)
\r
72 CanModify=CBool(accessRights="rw")
\r
73 oForm.options("canAdd")=CanModify
\r
74 oForm.options("canEdit")=CanModify
\r
75 oForm.options("canDelete")=CanModify
\r
88 response.write "<h2 class='appHeader'>" & replace(hdg,"<dialect>",oDB.Dialect) & "</h2>"
\r