sql="select * from gq where xs=1 order by date asc" rs.open sql,conn,1,1 if rs.eof and rs.bof then response.write"<A HREF=new0.asp?lbid=gqx ><%= gqx %></A>" else Response.Write "" end if set rs=nothing conn.close set conn=nothing
选择vb6中的项目菜单中的references ,选中microsoft activex data objects 2.0 library
(2)编写VB组件
接下来把<欲保护的asp代码>改写成VB组件,代码如下:
public function html_combo(disp_table as string) as string dim outstring as string dim conn as adodb.connection dim rst as adodb.recordset dim sqlstring as string set conn = createobject("adodb.connection") set rst = createobject("adodb.recordset") sqlstring = "select * from " & disp_table & " where xs=1 order by date asc" '以上是在VB中打开数据库操作,数据库中的表名、字段名,你可以根据自己的需要修改 conn.open "dsn=sumnet" rst.open sqlstring, conn, 3, 3 if rst.eof and rst.bof then outstring = "还没有这类单位信息"