Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unwanted Client Side Data Access

Status
Not open for further replies.

ISPrincess

Programmer
Feb 22, 2002
318
US
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:
Code:
<%Response.Buffer = true%>

<%
Dim sLocation, sServer
sLocation = session(&quot;Location&quot;)
sServer = session(&quot;Server&quot;)
%>

<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 <> &quot;&quot; Then
			sServer = document.All.srv.value
			sLocation = document.All.loc.value

			 sUID = &quot;DCS&quot;
			 sPWD = &quot;DCSBTG&quot;
			 Params = document.All.Location.value
	 
			sLocConnection = &quot;Provider=SQLOLEDB.1;server=&quot; & sServer & &quot;;database=&quot; & sLocation & &quot;;uid=DCS;pwd=DCSBTG&quot;
			Set cnn = createObject(&quot;Adodb.connection&quot;)
			cnn.CursorLocation = 3 'adUseClient
			cnn.CommandTimeout = 60
			cnn.Open sLocConnection
		
			Set rstReport = createobject(&quot;adodb.recordset&quot;)
			set rstReport = cnn.Execute(&quot;exec rpt_GetLineName2 &quot; & params)
			if not rstReport.EOF then document.All.LineName.value = rstReport.Fields(&quot;LineName&quot;)
			
			window.returnvalue = document.All.LineName.value
		end if
				
		
	end sub
</SCRIPT>
<Center>
<BR><BR><BR>
Location Prefix: <INPUT style=&quot;WIDTH: 48px; HEIGHT: 22px&quot; size=6 id=Location>
</Center>
<INPUT Type=Hidden style=&quot;WIDTH: 48px; HEIGHT: 22px&quot; 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=&quot;OK&quot; onClick=window.close id=button1 name=button1></center>
</BODY>
</HTML>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top