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

How to display connection errors in a message box.

Status
Not open for further replies.

balachandar

Programmer
Apr 16, 2001
88
CA
Hi All,
I have the following code. What are the changes that I need to make if I want to display the error description in a message box or or put that message in the toolbar.Please help me to do this.
Expecting your inputs

Thanks and Regards

<%@ Language=VBScript %>
<%
sub dbase()
dim objconn,objrs
dim objerrors,objerror
dim strconnect
strconnect =&quot;Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;password =password;Initial Catalog=master;Data Source=abc124&quot;
on error resume next
set objconn =server.CreateObject(&quot;ADODB.connection&quot;)
set objrs =server.CreateObject(&quot;ADODB.recordset&quot;)
set objerrors =objconn.Errors


objconn.Open strconnect

objrs.Open &quot;select top 5 * from sysolumns&quot; ,objconn
Response.Write &quot; error count is:&quot; & objerrors.count
if objconn.Errors.count >0 then
for each objerror in objerrors
Response.Write &quot;error desciption -------------&quot;

Response.Write objerror.description
Response.Write &quot;<br>&quot;
next
exit sub
end if

while not objrs.EOF
Response.Write objrs.Fields(5)
Response.Write &quot;<p>&quot;
objrs.MoveNext
wend

objrs.Close
objconn.Close

set objrs =nothing
set objconn =nothing

end sub

%>

<HTML>
<HEAD>
<META NAME=&quot;GENERATOR&quot; Content=&quot;Microsoft Visual Studio 6.0&quot;>
</HEAD>
<BODY>
<%call dbase()%>

<P> </P>

</BODY>
<%

%>
</HTML>
 
balachandar;

objconn.Open strconnect
objrs.Open &quot;select top 5 * from sysolumns&quot; ,objconn
If err.number <> 0 then
Response.Write &quot;<input type='text' name='txterr' value='&quot; & err.number & &quot;'>&quot;
err.clear
End If


fengshui_1998
 
Hi fengshui_1998,
Thanks for the reply. But this functionality exists in the code as it is. My doubt is if instead of writing into the browser, how can show it in a message box .

Thanks for the help
Regards
Balachandar

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top