用dll连接数据库

awash 2001-05-07 09:45:00
以下是一个vb的class,用于连接数据库。


******

VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "Class1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Public Function getCatalog() As Object
Dim rds As New ADODB.Recordset
rds.CursorLocation = adUseClient
rds.CursorType = adOpenForwardOnly
rds.LockType = adLockReadOnly
Dim strServer, brokerAddress As String
Dim strPort As String

rds.Open "select * from LUMA_Catalog", _
"Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=LUMA"


Set rds.ActiveConnection = Nothing
Set getCatalog = rds
End Function

****


以下是asp文件,调用上面的class


******

<%@ Language=VBScript %>
<%
On error resume next

Dim Cat
Dim rsCarlist

set Cat = Server.CreateObject("Lumacars.Catalog")
if err.number<>0 then
Response.Write "Error1 "
Response.End
end if

Set rsCarList = Cat.getCatalog()
if err.number<>0 then
Response.Write "Error2"
Response.End
end if
%>

<html>

<head>
<style>
A{ FONT-FAMILY: 'MS Sans Serif';
TEXT-DECORATION: none}
TD{ FONT-FAMILY: 'MS Sans Serif'}
H2{ FONT-FAMILY: 'MS Sans Serif'}
H6{ FONT-FAMILY: 'MS Sans Serif';
FONT-SIZE: xx-small;
FONT-WEIGHT: 100;
COLOR: #0000ff;
TEXT-DECORATION: none}
</style>

<meta NAME="GENERATOR" Content="Microsoft FrontPage 4.0">
</head>

<body>
<form name="fChoice" method="POST" action="Confirm.asp">
<input type="hidden" name="CarID">
<input type="hidden" name="Price">
<input type="hidden" name="Model">

<table border="0" width="100%">
<tr>
<td>
<img SRC="images/BG1.gif">
</td>
<td width="100%" colspan="2" Align="middle">
<img SRC="images/Luma.gif">
</td>
<td>
<img SRC="images/BG2.gif">
</td>
</tr>
<tr>
<td colspan="4" align="middle">
<img SRC="images/Buy.gif">
</td>
</tr>
<tr>
<td></td>
<td bgcolor="#d3d3d3">
<h4>MODEL</h4>
</td>
<td bgcolor="#d3d3d3" align="right">
<h4>PRICE</h4>
</td>
<td> </td>
</tr>
<%
while not rsCarList.EOF
CarID=rsCarList.Fields("CarID")
Description=rsCarList.Fields("Description")
Price=rsCarList.Fields("Price")
%>
<tr>
<td> </td>
<td>
<a href="javascript:Confirm('<%=CarID%>','<%=Price%>','<%=Description%>')"> <%=Description%></a>
</td>
<td align="right"><%=Price%> </td>
</tr>
<%rsCarList.movenext
wend
%>
<tr>
<td colspan="4"> </td>
</tr>
<tr>
<td valign="top">
<img SRC="images/BG4.gif">
</td>
<td width="100%" align="right" colspan="2">
<h6>Webmaster: mauro_romani@hotmail.com  </h6>
</td>
<td valign="top">
<img SRC="images/BG3.gif">
</td>
</tr>
</table>
</form>
</body>
</html>

<script LANGUAGE="javascript">
<!--
function Confirm (CarID,Price,Model)
{
document.fChoice.CarID.value=CarID;
document.fChoice.Price.value=Price;
document.fChoice.Model.value=Model;
document.fChoice.submit();
}
//-->
</script>

******


运行时显示"Error2",即调函数出错。请问为何?
...全文
101 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧