Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
Check database connection info
Old 03-15-2009, 04:38 AM Check database connection info
itHighway's Avatar
Skilled Talker

Posts: 83
Name: Zeeshan Dar
Location: GUJ
Trades: 0
Hello,

I have a form where a user provide database connection info and than click "Test" button to check if given database info is correct or not.

If database is MS Access then user provides database name and path and if it is Sql Server than user provides sql server connection info.

Is there any command or script that check database connection info and find whether info provided by user is correct or not?


Thank you,
__________________
Zeeshan Dar
itHighway -
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
itHighway is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-15-2009, 05:52 PM Re: Check database connection info
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,515
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Error handling in ASP VbScript is a little primitive but effective if you know how to use it. This shows how for an Access DB with a connection string.
Code:
dim m_oConn   
dim m_oConnString

set m_oConn=server.createobject("ADODB.connection")
'build your connection here

m_oConnString = "PROVIDER=Microsoft.Jet.OLEDB.4.0; Data Source= " & server.mappath("/db/access.mdb")


on error resume next ' set error trapping 
m_oConn.Open m_oConnString ' try to open the connection 

if err.number <> 0 then
'handle the error here
' this will just print out the error description
  response.write "Whoops! This happened <br>"
  response.write err.description
else
  response.write "Whoo Hoo!!"
end if
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to Check database connection info
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.30521 seconds with 12 queries