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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

new to inter dev getting an error message

Status
Not open for further replies.

Juddy58

Technical User
Jan 21, 2003
176
AU
Hello i am attempting my first asp in interdev ver6. the page is meant to connect to SQL server2000 and get data from the northwind database. The project called CustomerAsp, contains a global.asa file and customer.asp page.

global.asa contains the following code:
------------------------------------------------
<SCRIPT LANGUAGE=VBScript RUNAT=Server>
Sub Application_OnStart()
application(&quot;DBconn&quot;)=&quot;Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Northwind;Data Source=600X;&quot;
End Sub
</SCRIPT>
------------------------------------------------

customer.asp contains the following code:
-------------------------------------------------
<%@ Language=VBScript %>
<HTML>
<HEAD>
<META NAME=&quot;GENERATOR&quot; Content=&quot;Microsoft Visual Studio 6.0&quot;>
</HEAD>
<BODY>
<%
dim cn
dim rs

set cn=server.CreateObject(&quot;ADODB.connection&quot;)
cn.Open(application(&quot;DBConn&quot;))
sSQL=&quot;select CustomerID, CompanyName, &quot; & _
&quot;ContactName, Country from Customers&quot;
set rs=cn.Execute(sSQL)
%>
<TABLE Border=&quot;1&quot; Cellspacing=&quot;2&quot; Cellpadding=&quot;2&quot;>
<TR>
<TH>Customer ID </TH>
<TH>Company Name</TH>
<TH>Contact Name</TH>
<TH>Country</TH>
</TR>
<%
do until re.EOF
Response.Write(&quot;<TR>&quot;)
Response.Write(&quot;<TD>&quot; & rs(&quot;CustomerID&quot;) & &quot;</TD>&quot;)
Response.Write(&quot;<TD>&quot; & rs(&quot;CompanyName&quot;) & &quot;</TD>&quot;)
Response.Write(&quot;<TD>&quot; & rs(&quot;ContactName&quot;) & &quot;</TD>&quot;)
Response.Write(&quot;<TD>&quot; & rs(&quot;Country&quot;) & &quot;</TD>&quot;)
Response.Write(&quot;</TR>&quot;)
rs.MoveNext
loop
%>

<P> </P>

</BODY>
</HTML>
---------------------------------------------------
When i try to preview this page in explorer i get the following error:
--------------------------------------------------
There is a problem with the page you are trying to reach and it cannot be displayed.

Please try the following:
Open the 600x home page, and then look for links to the information you want.
Click the Refresh button, or try again later.

Click Search to look for information on the Internet.
You can also see a list of related sites.

HTTP 500 - Internal server error
Internet Explorer
--------------------------------------------------

i have tried looking for this error on the Microsoft website and no luck.If anyone has any advice as to something i have missed or need to do it would be greatly appreciated,
Thanks
Justin
 
change this:set rs=cn.Execute(sSQL)

to:
set rs=server.createobject(&quot;ADODB.Recordset&quot;)
rs.open sSQL,cn

this is a damn problem with IIS sometimes it doesnt show u the line where the error is there it simply shows a general page..
to debug it u have to go line by line...

suppose u have a page:
<%
a=&quot;ADS&quot;
b=cint(a)
%>

instead of pointing to line 2 sometimes it will simply give an error..

to debug:
<%
a=&quot;ADS&quot;
response.end
b=cint(a)
%>
response.end will stop execution of the page, u have to shift from line to line to know where the error is.. sometimes iis will display the error, but BEWARE!!!

Known is handfull, Unknown is worldfull
 
thanks for the reply vbkris.
I have made the changes you suggested but still no luck. I used your suggestion of using response.end on each line of the code. The error seems to occur after this line
cn.Open(application(&quot;DBConn&quot;))
so im assuming it could be to do with accessing sql server.
Just wondering if i need to select any references in visual interdev for the code i have shown, currently i have none selected, and i wouldn't have a clue which ones i should have selected(if any!)
Any more suggestions would be greatly appreciated,
Thanks,
Justin
 
the problem as i guessed is with the connection string... how did u bulid it?

Known is handfull, Unknown is worldfull
 
for the connection string i created a file in notepad, then saved it in .udl format. i then reopened it and used the data link properties menu to select the appropriate properties i tested this connection in the menu and it appeared to work.
 
use a udl file when u don not want connection string!!!

create a text file rename it as udl... connect to ur database..

in the connection string:
con.open &quot;File:=UDLPath&quot; (Check the format)



Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top