473,405 Members | 2,185 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Sample ASP Script??

Hello,

Im brand new and trying to learn SQL Server 2000, I have purchased a book
and been reading it for a few weeks.

I'm tring to find an ASP script that would let me know if my connection to
my database is working.

I use DSN, i created a DSN name "mail"

anyone have any scripts?

--
Message posted via http://www.sqlmonster.com
Jul 23 '05 #1
4 1381
Hi

Check out:
http://www.aspfaq.com/show.asp?id=2351

There are loads of things on that site which you will find useful.

John

"Chad Benjamin via SQLMonster.com" <fo***@SQLMonster.com> wrote in message
news:96******************************@SQLMonster.c om...
Hello,

Im brand new and trying to learn SQL Server 2000, I have purchased a book
and been reading it for a few weeks.

I'm tring to find an ASP script that would let me know if my connection to
my database is working.

I use DSN, i created a DSN name "mail"

anyone have any scripts?

--
Message posted via http://www.sqlmonster.com

Jul 23 '05 #2
You really want to use DSN-less connections. Your code will be portable.

But, to use your DSN connection you would do the following:

<%
dim cn
set cn = Server.CreateObject("ADODB.Connection")
cn.ConnectionString = "DSN=mail.dsn"
cn.Open
if cn.State <> 1 then
Response.Write "Could not connect to database"
else
Response.Write "Connected!!"
end if
cn.Close
set cn = nothing
%>
On 3/28/05 2:02 PM, in article
96******************************@SQLMonster.com, "Chad Benjamin via
SQLMonster.com" <fo***@SQLMonster.com> wrote:
Hello,

Im brand new and trying to learn SQL Server 2000, I have purchased a book
and been reading it for a few weeks.

I'm tring to find an ASP script that would let me know if my connection to
my database is working.

I use DSN, i created a DSN name "mail"

anyone have any scripts?


Jul 23 '05 #3
Hi I tried your code you gave me but got an error.

[Microsoft][ODBC Driver Manager] Data source name not found and no default
driver specified
any ideas?

--
Message posted via http://www.sqlmonster.com
Jul 23 '05 #4
That code was for a File DSN. You would need to change the code to include
the full path to the file.

A system DSN (probably what you are using) should look like this.

cn.Open "DSN=mail;" & _
"Uid=user;" & _
"Pwd=password"

Of course, you need to edit "user" and "password"

-Greg
On 3/29/05 3:26 AM, in article
c5******************************@SQLMonster.com, "Toby Benjamin via
SQLMonster.com" <fo***@SQLMonster.com> wrote:
Hi I tried your code you gave me but got an error.

[Microsoft][ODBC Driver Manager] Data source name not found and no default
driver specified
any ideas?


Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jean Stax | last post by:
Hi! I just read in "Writing Secure Code" book a chapter about Cross-Site Scripting. Here the relevant paragraph: This is bad because a malicious user could access another's important data,...
0
by: Subrahmanyam Arya | last post by:
Dear oracle gurus, Does any body have a sample online hotbackup script for UNIX. My oracle version is oracle 8.1.7.4 running on solaris 8. -your help is appreciated, sincerely avsrk
4
by: Tim Morrison | last post by:
SQL Server 2000 Is there any way to take sample data in my database and create an INSERT INTO script? I have a commercial application that I would like to include sample data, and instead of...
3
by: John MacIntyre | last post by:
Hi, Can anybody give me a hint as to how to convert a javascript array into a vbscript array? BTW-it only needs to work in IE5 & 6 Thanks in advance, John MacIntyre VC++ / VB / ASP /...
4
by: David | last post by:
Hi, I am new to DB2. Does someone have a sample DB2 script they can post here? All I want to do is execute a SQL query like this: SELECT * FROM TABLE Also, can someone post a sample AIX...
8
by: siol | last post by:
Hy! I have htmleditor (from the microsoft's samples page) embeded into my asp.net page. Editor generates some html code inside <div id="oDiv"></div> tags. And what I would like to do is return...
2
by: mirandacascade | last post by:
Situation is this: 1) must write application that does the following: a) creates an xml document, the contents of which, is a request transaction b) send xml document to destination; I am...
10
by: celoftis | last post by:
Using VS 2005: This morning, following the instructions here: http://ajax.asp.net/docs/overview/InstallingASPNETAJAX.aspx, I installed ASP.NET AJAX on my WinXP Pro development machine. Following...
5
by: Otto Wyss | last post by:
I've now been looking for a week for a simple but useful sample on how to get a list of entries (persons) via an XMLHttpRequest using Json/PHP on the server. So far I've found about a thousend...
2
by: Jon Paal [MSMD] | last post by:
trying to test these old guys on win xp pro sp2 http://support.microsoft.com/kb/249290 Sample ASP script can't instantiate object
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.