// Copyright 2001-2002 Macromedia, Inc. All rights reserved.
<SCRIPT LANGUAGE=VBScript RUNAT=Server>
function CreateVBArray(elem1,elem2,elem3,elem4)
elem1 = "" + elem1
elem2 = "" + elem2
elem3 = "" + elem3
elem4 = "" + elem4
if (Len(elem1) = 0) then
elem1 = Empty
end if
if (Len(elem2) = 0) then
elem2 = Empty
end if
if (Len(elem3) = 0) then
elem3 = Empty
end if
if (Len(elem4) = 0) then
elem4 = Empty
end if
if (elem4 = "PrimaryKeys") then
CreateVBArray = Array(elem1,elem2,elem3)
else
CreateVBArray = Array(elem1,elem2,elem3,elem4)
end if
end function
</SCRIPT>
<SCRIPT LANGUAGE=JavaScript RUNAT=Server>
function CreateMMConnection(ConnectionString,UserName,Password,Timeout)
{
var Object;
Object = new MMConnection(ConnectionString,UserName,Password,Timeout);
return Object;
}
function MMConnection(ConnectionString,UserName,Password,Timeout)
{
MMConnReconnect(this);
this.isOpen = false;
this.ConnectionString = ConnectionString;
this.UserName = String(UserName);
this.Password = String(Password);
this.Connection = Server.CreateObject("ADODB.Connection");
this.Connection.ConnectionTimeout = Timeout;
}
function MMConnReconnect(Object)
{
Object.GetODBCDSNs = ConnGetODBCDSNs;
Object.Open = ConnOpen;
Object.GetTables = ConnGetTables;
Object.GetViews = ConnGetViews;
Object.GetProcedures = ConnGetProcedures;
Object.GetColumnsOfTable = ConnGetColumns;
Object.GetPrimaryKeysOfTable = ConnGetPrimaryKeys;
Object.GetParametersOfProcedure = ConnGetParametersOfProcedure;
Object.ExecuteSQL = ConnExecuteSQL;
Object.ExecuteSP = ConnExecuteSP;
Object.ReturnsResultSet = ConnReturnsResultSet;
Object.SupportsProcedure = ConnSupportsProcedure;
Object.GetProviderTypes = ConnGetProviderTypes;
Object.HandleExceptions = ConnHandleExceptions;
Object.TestOpen = ConnIsOpen;
Object.Close = ConnClose;
}
function ConnOpen()
{
var theConnectionString = new String(this.ConnectionString);
// ????????????? OBSOLETE: begin ????????????????????????????????
if (this.UserName && this.UserName.length)
{
theConnectionString = theConnectionString + ";uid=" + this.UserName;
}
if (this.Password && this.Password.length)
{
theConnectionString = theConnectionString + ";pwd=" + this.Password;
}
// ????????????? OBSOLETE: end ????????????????????????????????
// The given connection string may not be formatted for OLE DB. It may, for example,
// be a SQL Server connection string. In such cases we need to morph it into
// an OLE DB connection string so it can be digested by the ADODB.Connection that
// we're using.
//
// For now, we are only dealing with morphing SQL Server connection strings. In the
// future, this logic may have to be expanded to deal with Oracle, Informix, etc. as
// those vendors make their own ASP.Net drivers available for use (circumventing
// the current need to go through OLE DB to access those databases).
var dbType = Request("DATABASETYPE");
if (dbType != null)
{
var strDBtype = new String(dbType);
if ((strDBtype.length > 0) && (strDBtype.toLowerCase() == "sqlserver"))
{
if (theConnectionString.charAt(0) == "\"")
{
theConnectionString = "\"Provider=SQLOLEDB;" + theConnectionString.substring(1);
}
else
{
theConnectionString = "Provider=SQLOLEDB;" + theConnectionString;
}
}
}
var aConn = ConnEval(theConnectionString);
this.Connection.Open(aConn);
this.isOpen = (this.Connection.State == adStateOpen);
}
function ConnIsOpen()
{
var xmlOutput = "";
if (this.isOpen)
{
xmlOutput = xmlOutput + "<TEST status=";
xmlOutput = xmlOutput + this.isOpen;
xmlOutput = xmlOutput + "></TEST>";
}
return xmlOutput;
}
function ConnClose()
{
if (this.Connection && this.isOpen)
{
this.Connection.Close();
}
}
function ConnGetTables(SchemaName,CatalogName)
{
if (this.Connection && this.isOpen)
{
var VBVariant = new VBArray(CreateVBArray(CatalogName,SchemaName,"","TABLE"));
return MarshallRecordsetIntoHTML(this.Connection.OpenSchema(adSchemaTables,VBVariant));
}
return null;
}
function ConnGetViews(SchemaName,CatalogName)
{
if (this.Connection && this.isOpen)
{
var VBVariant = new VBArray(CreateVBArray(CatalogName,SchemaName,"","VIEW"));
return MarshallRecordsetIntoHTML(this.Connection.OpenSchema(adSchemaTables,VBVariant));
}
return null;
}
function ConnGetProcedures(SchemaName,CatalogName)
{
if (this.Connection && this.isOpen)
{
var VBVariant = new VBArray(CreateVBArray(CatalogName,SchemaName,"",""));
return MarshallRecordsetIntoHTML(this.Connection.OpenSchema(adSchemaProcedures,VBVariant));
}
return null;
}
function ConnGetColumns(TableName,SchemaName,CatalogName)
{
if (this.Connection && this.isOpen)
{
var VBVariant = new VBArray(CreateVBArray(CatalogName,SchemaName,TableName,""));
return MarshallRecordsetIntoHTML(this.Connection.OpenSchema(adSchemaColumns,VBVariant));
}
return null;
}
function ConnGetPrimaryKeys(TableName,SchemaName,CatalogName)
{
if (this.Connection && this.isOpen)
{
var VBVariant = new VBArray(CreateVBArray(CatalogName,SchemaName,TableName,"PrimaryKeys"));
return MarshallRecordsetIntoHTML(this.Connection.OpenSchema(adSchemaPrimaryKeys,VBVariant));
}
return null;
}
function ConnGetParametersOfProcedure(ProcedureName,SchemaName,CatalogName)
{
if (this.Connection && this.isOpen)
{
var VBVariant = new VBArray(CreateVBArray(CatalogName,SchemaName,ProcedureName,""));
return this.Connection.OpenSchema(adSchemaProcedureParameters,VBVariant);
}
return null;
}
function ConnExecuteSQL(aStatement,MaxRows)
{
if (this.Connection && this.isOpen)
{
var oRecordset = Server.CreateObject("ADODB.Recordset");
if (oRecordset)
{
aStatement = "" + aStatement;
oRecordset.MaxRecords = MaxRows;
oRecordset.Open(aStatement,this.Connection);
return MarshallRecordsetIntoHTML(oRecordset);
}
}
return null;
}
function ConnGetProviderTypes()
{
if (this.Connection && this.isOpen)
{
return MarshallRecordsetIntoHTML(this.Connection.OpenSchema(adSchemaProviderTypes));
}
return null;
}
function ConnExecuteSP(aProcStatement,TimeOut,Parameters)
{
if (this.Connection && this.isOpen)
{
var oCommand = Server.CreateObject("ADODB.Command");
aProcStatement = "" + aProcStatement;
oCommand.CommandTimeout = TimeOut;
oCommand.CommandText = aProcStatement;
oCommand.CommandType = adCmdStoredProc;
oCommand.ActiveConnection = this.Connection;
Parameters = "" + Parameters;
if (!Parameters.length)
{
if (oCommand)
{
return MarshallRecordsetIntoHTML(oCommand.Execute());
}
}
else
{
//Substitute Parameters.
var Params = Parameters;
var ParamArray = new Array();
if (Params && Params != "undefined")
{
var cSize = 0;
for (;;)
{
var index = Params.indexOf(",");
if (index == -1)
{
index = Params.length;
}
var name = Params.substring(0,index);
Params = Params.substring(index+1,Params.length);
index = Params.indexOf(",");
if (index == -1)
{
index = Params.length;
}
var value = Params.substring(0,index);
var Pair = new Object();
Pair.name = name;
Pair.value = value;
ParamArray[cSize] = Pair;
cSize++;
if (index >= Params.length)
{
break;
}
Params = Params.substring(index+1,Params.length);
}
if (oCommand.Parameters.Count == -1)
{
//Create Parameters
var oRecordset = ConnGetParametersOfProcedure(aProcStatement);
if (oRecordset)
{
var pCount=0;
while (!oRecordset.EOF)
{
var pName = oRecordset.Fi
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
guestbook.rar (76个子文件)
guestbook
gbook
gbook_admin.jsp 19KB
Next.gif 67B
images
admin.gif 2KB
browse_over.gif 2KB
table_bottom.jpg 14KB
add.gif 2KB
pic
06.gif 2KB
07.gif 2KB
03.gif 2KB
_notes
dwsync.xml 1KB
08.gif 4KB
02.gif 1KB
Thumbs.db 60KB
05.gif 2KB
01.gif 2KB
04.gif 2KB
back-2.jpg 42KB
www.gif 1KB
ico_del.gif 1KB
pen.gif 1KB
add_over.gif 2KB
_notes
digiBoard_r2_c4.gif.mno 112B
dwsync.xml 3KB
digiBoard_r2_c1.gif.mno 112B
digiBoard_r2_c5.gif.mno 112B
digiBoard_r2_c3.gif.mno 97B
top.jpg.mno 112B
hls_notepad.gif.mno 112B
digiBoard_r2_c2.gif.mno 112B
bottom.jpg.mno 112B
guestbook_title.jpg.mno 97B
admin_over.gif 2KB
ico_edit.gif 1KB
pen.jpg 1KB
icons.gif 2KB
Thumbs.db 88KB
email.gif 797B
table_top.jpg 14KB
table_back.jpg 14KB
back.jpg 7KB
browse.gif 2KB
guestbook_title.jpg 27KB
notepad.gif 1KB
gbook_add.jpg 42KB
_notes
.mno 128B
dwsync.xml 2KB
gbook_admin.jsp.mno 372B
gbook_add.jsp.mno 374B
gbook_del.jsp.mno 373B
gbook_upd.jsp.mno 373B
gbook.jsp.mno 372B
Last.gif 93B
gbook_add.jsp 17KB
gbook_login.jsp 7KB
Thumbs.db 8KB
gbook_del.jsp 14KB
gbook_upd.jsp 16KB
Connections
_notes
dwsync.xml 229B
connGuestBook.jsp 387B
First.gif 128B
gbook.jsp 20KB
Previous.gif 67B
_mmServerScripts
MMHTTPDB.jsp 20KB
getWEBxml.jsp 1KB
_notes
dwsync.xml 712B
MMHTTPDB.asp 2KB
error.jsp 338B
MMHTTPDB.js 24KB
getTLD.jsp 3KB
adojavas.inc 10KB
data的部分
gbook
admins.frm 8KB
admins.MYI 2KB
gbook.frm 9KB
admins.MYD 21B
gbook.MYD 696B
gbook.MYI 2KB
共 76 条
- 1
资源评论
mclo_paddy
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功