|
-
Apr 24th, 2001, 08:30 AM
#1
Thread Starter
Fanatic Member
Here is an ASP question....
How do you interrogate tables of a linked server in M$ SQL Server, using ASP? Please note the linked server within M$ SQL Server is called DIUI002.
Below is a copy of the current code:
<%
strMSSQL = "SELECT oralnk.loc_name FROM DIUI002.location AS oralnk"
' Connect to the MS SQL server
session("VarServerIP") = "151.124.142.22"
session("VarUserName") = "UID"
session("VarPassword") = "password"
session("VarDatabaseName") = "EGDB"
set MSconn=server.createobject("ADODB.connection")
MSconn.Open "Driver={SQL Server}; Server=" & session("VarServerIP") & "; Database=" & session("VarDatabaseName") & "; UID=" & Session("VarUserName") & "; PWD=" & Session("VarPassword") & ";"
Set msrs = SERVER.CreateObject("ADODB.Recordset")
set msrs = MSconn.Execute (strMSSQL)
' Build a table
Response.Write("<TABLE ALIGN=CENTER CELLSPACING=2 CELLPADDING=1 COLS=1 WIDTH='50%'>")
Response.Write("<TR>")
Response.Write("<TD ALIGN=CENTER VALIGN=CENTER WIDTH=50% BGCOLOR=#C8C8FF><B>Location</B></TD>")
Do While Not msrs.EOF
Response.Write("<TD ALIGN=CENTER VALIGN=CENTER BGCOLOR=#F0F0FF>" & msrs("loc_name") & "</TD>")
Response.Write("</TR>")
msrs.MoveNext
Loop
Response.Write("</TABLE>")
msrs.Close
Set msrs=Nothing
MSconn.Close
Set MSconn = Nothing
%>
Thanks in advance!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|