win98+PWS环境下连接读取远程SQLServer
2024-07-21 02:10:53
供稿:网友
from: http://www.planet-source-code.com/vb/scripts/showcode.asp?lngwid=4&txtcodeid=6518
connect/read remote sql server using pws in win 98
i had to test microsoft's personal webserver (pws) in win 98 to access remote sql server 7.0
installed in a nt server. the clients to win 98 had lan connections. easy one , don't vote, have fun with
pws. in fact i tested my connection with this script, before i created an out of process server demo with
vb.
code:
can't copy and paste this?
click here for a copy-and-paste friendly version of this code!
terms of agreement:
by using this code, you agree to the following terms...
1) you may use this code in your own programs (and may compile it into a program and distribute it in
compiled format for langauges that allow it) freely and with no charge.
2) you may not redistribute this code (for example to a web site) without written permission from the
original author. failure to do so is a violation of copyright laws.
3) you may link to this code from another website, but only if it is not wrapped in a frame.
4) you will abide by any additional copyright restrictions which the author may have placed in the code or
code's description.
'**************************************
' name: connect/read remote sql server u
' sing pws in win 98
' description:i had to test microsoft's
' personal webserver (pws) in win 98 to ac
' cess remote sql server 7.0 installed in
' a nt server. the clients to win 98 had l
' an connections. easy one , don't vote, h
' ave fun with pws. in fact i tested my co
' nnection with this script, before i crea
' ted an out of process server demo with v
' b.
' by: manas mukherjee
'
' assumes:knowing little bit of lan woul
' d help , vpn, html, creating virtual dir
' ectory with pws
'
'this code is copyrighted and has ' limited warranties.please see http://w
' ww.planet-source-code.com/xq/asp/txtcode
' id.6518/lngwid.4/qx/vb/scripts/showcode.
' htm 'for details. '**************************************
<html><head>
<title> asp_pubs/sql server in nt server</title>
</head>
<body><center>
<%
dim objconn, objrs, strq, strout, i
set objconn = server.createobject("adodb.connection")
objconn.open "provider=sqloledb.1;integrated security=sspi;persist security info=false;initial
catalog=pubs;data source=//urservername"
set objrs = server.createobject("adodb.recordset")
strq = "select emp_id, fname, lname,job_id "
strq = strq & "from employee "
objrs.open strq, objconn, , , adcmdtext
%>
<table border=1 cellpadding=4>
connected to the database pubs
using connect string "provider=sqloledb.1;integrated security=sspi;persist security info=false;initial
catalog=pubs;data source=//urservername"
<th> "employeeid" </th>
<th> "firstname" </th>
<th> "lastname" </th>
<th> "job_id" </th>
<% do while not objrs.eof %> <tr>
<td> <% = objrs("emp_id") %>
<td> <% = objrs("fname") %>
<td> <% = objrs("lname") %></tr>
<td> <% = objrs("job_id") %></tr>
<% objrs.movenext %>
<% loop %>
<% objrs.close %>
<% set objrs = nothing %>
<% set objconn = nothing %>
</table>
</center>
</body>
</html>