ISPrincess
Programmer
The following code is a page that needs to get a recordset on its ononload event - therefore it is client side data access via SQL.
I need help with this script (to be applied to others where I must load up my user's Excel - also client side script). Either I have the Monday morning brainlessness problem and I need help getting the results of the data query to server side or I need to disable the annoying question that our users' must answer 'yes' to in order to see the results - following:
This page is trying to access a data source on another domain. Do you wish to allow this?
Here is my code:
I need help with this script (to be applied to others where I must load up my user's Excel - also client side script). Either I have the Monday morning brainlessness problem and I need help getting the results of the data query to server side or I need to disable the annoying question that our users' must answer 'yes' to in order to see the results - following:
This page is trying to access a data source on another domain. Do you wish to allow this?
Here is my code:
Code:
<%Response.Buffer = true%>
<%
Dim sLocation, sServer
sLocation = session("Location")
sServer = session("Server")
%>
<HTML>
<BODY bottomMargin=1 leftMargin=1 topMargin=1 rightMargin=1 bgColor=steelblue>
<SCRIPT LANGUAGE=VBSCRIPT>
Sub window_onunload
Dim rstReport
Dim sLocConnection
Dim sUID, sPWD, Params
Dim cnn
if document.All.location.value <> "" Then
sServer = document.All.srv.value
sLocation = document.All.loc.value
sUID = "DCS"
sPWD = "DCSBTG"
Params = document.All.Location.value
sLocConnection = "Provider=SQLOLEDB.1;server=" & sServer & ";database=" & sLocation & ";uid=DCS;pwd=DCSBTG"
Set cnn = createObject("Adodb.connection")
cnn.CursorLocation = 3 'adUseClient
cnn.CommandTimeout = 60
cnn.Open sLocConnection
Set rstReport = createobject("adodb.recordset")
set rstReport = cnn.Execute("exec rpt_GetLineName2 " & params)
if not rstReport.EOF then document.All.LineName.value = rstReport.Fields("LineName")
window.returnvalue = document.All.LineName.value
end if
end sub
</SCRIPT>
<Center>
<BR><BR><BR>
Location Prefix: <INPUT style="WIDTH: 48px; HEIGHT: 22px" size=6 id=Location>
</Center>
<INPUT Type=Hidden style="WIDTH: 48px; HEIGHT: 22px" size=6 id=LineName>
<INPUT type=Hidden id=Loc name=Loc value=<%=sLocation%>>
<INPUT type=Hidden id=Srv name=Srv value=<%=sServer%>>
<BR>
<center><INPUT type=button value="OK" onClick=window.close id=button1 name=button1></center>
</BODY>
</HTML>