Learning is not attained by chance, it must
be sought for with ardor and diligence.
-Abigail Adams
Home   News   Tips   Glossary   Templates   Forums   Help   Logon   Order   Contact Us  

News      User Comments     History     Notify Me

8/20/2008 1:31:00 AM
Active Server Pages 301
By Richard Rost   Richard Rost on Facebook Richard Rost on Twitter Richard Rost on Google Plus Richard Rost on LinkedIn Email Richard Rost

ASP 301 covers DATABASES: Setting up a Database, Connecting to a Database, Using ODBC Data Sources, Reading Records from a Table, Looping Through a Set of Records, Adding Records to your Table.

See the complete outline here: /site/courselist/asp/asp301/

Permanent Link
Course Link: Active Server Pages 301
Keywords: asp database odbc records table add
Post Reply

Connection Error Comment from Salvatori C @ 10/11/2014
Hey now, I'm trying connecting to a accdb with no luck, no option to save as a .mdb regarding the access database and no option to add to the DNS,
Thanks in advance

Reply from Alexander Hedley:

What is your connection string?
The Provider is different from ACCDB to MDB.

Conn.Provider = "Microsoft.Jet.OLEDB.4.0;
Show Just This Thread        Post Reply
ASP errors Comment from Mubeezi Micah @ 1/1/2013
Dear Richard,

Time index 5:43
Now that i can easily see any errors generated, I managed to connect to my db using this method. Thank you for your continuous support.


Reply from Richard Rost:

You're very welcome.
Show Just This Thread        Post Reply
user does not enter a valid date Comment from Mubeezi Micah @ 12/31/2012
Dear Richard,

Time index 14:35
I am struggling with a situation when a user does not enter a valid date. I have tried using On Error Resume Next. The error gets ignored but the record does not get written into the table.

Please advice me what i can do.
Thank you!

Reply from Richard Rost:

Well, first make sure there's something in the field. Then specifically convert it to a DATE value and make sure it's within a valid date range. I do something like this:

MyDateTxt = request("MyDateField")
If MyDateTxt = "" then response.write "INVALID DATE"
MyDate = CDATE(MyDateText)
if MyDate < #1/1/2001# or MyDate > Now() then response.write "INVALID DATE"

Something along those lines.
Show Just This Thread        Post Reply
Comment from John Sottile @ 4/15/2009
report - internet and distributed files system (DFS)

setting up a DFS common folder ath for ASP script testing.  I've got a LAN with 4 machines.  Learned that the SYSVOL on the server (\\servername\domain.local is the path to the LAN's Server Logon system, which is also the SYSVOL folder.  I plan to put main DFS shared folder on the SYSVOL (domain common folder).  I am having difficulty using a script to access SQL Server data, unless I am signed on as the administrator which is the password used with the install of SQL Server 2000.  I hope to allow others to access data across my domain but logon for them may take time.  This seemed a useful trick, I have enough literature.  The first item syuggested was to remove delete permissions on all of the drive letters, even to administrators.  So that no one deletes the whole drive and 300 gigs of my data.  I almost did that myself today.  
Show Just This Thread        Post Reply
Comment from Richard Rost @ 4/14/2009
James, there are a couple of ways you can write that connection string. The method I show is my preferred method. I don't personally like including the Data Source inside the Provider string like they showed you, but it should work fine. Ask them to provide you with the EXACT connection string that you need.
Show Just This Thread        Post Reply
Comment from james delaverson @ 4/10/2009
asp301-lesson 3 06:20
Your example did not work on my web site. Here is what my provided said I need to make the connection. I don't know how to place it into your example.

'Database connection info and provider
strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &_
Show Just This Thread        Post Reply
Comment from Gary Gomer @ 12/6/2008

I am trying to use the DSN database connection in ASP301 and I couldn't get it working. Here is my code:

DSN = "ASP300" ' Name of the ODBC Connection

Set Conn = Server.CreateObject ("ADODB.Connection") ' Creates a connection to the database ADODB (Active X Data Objects B)
Conn.ConnectionString="DSN=" & DSN

Set RS = Server.CreateObject("ADODB.Recordset") ' Tell it what recordsets / Queries to look at

RS.Open "CustomerT", Conn  'Tell it What Database to open (CustomerT) and what connection to use to Open It(Conn)

Response.write RS("FirstName") ' Will write the first name on the first record

Set RS = Nothing
Set Conn = Nothing


Here is the error I am getting:

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

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

/ASP301/DSNDefault.asp, line 7

Line 7 is : Conn.Open

Any idea what is wrong?

Show Just This Thread        Post Reply

Add Your Comments or Subscribe
If you just want to subscribe to get email updates when the News is updated, then enter your name and email address and check the Notify Me box below. If you would optionally like to add your comments below to be posted, they are welcome.
  Your Name:  Required
  Your Email:  NOT Public


Sorry about this step. It's just to keep the spam bots away:
  Verify: What is 6+9:
  Notify me when the News is updated.
  Remember Me for my next comments
Please do not use this form for Customer Service inquiries! If you have questions about your account, shipping info, courses you've ordered, need passwords, etc. please use the Customer Service Center instead.

I value your comments. They will be displayed on this page (above). Your name will be displayed, but your email address will not be.
As always, I promise to never give away your personal information to anyone else, ever.

NOTE: If you don't leave your name and email address, DON'T expect a reply. I can't promise a personal reply to everyone who posts here. I TRY my best, but I cannot guarantee it. If you don't leave your real name and email address, I won't even bother. I usually just hit DELETE. -Richard



Visual Basicindex
Account Login
Online Theater
Lost Password
Free Upgrades
Insider Circle
Student Databases
Change Email
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search Our Site
Waiting List
Production Schedule
Collapse Menus
Live Chat
Customer Support
WalkThru Tutorials
Consulting Services
About Us
Affiliate Program
Richard Rost
Free Lessons
Mailing List
Video Tutorials
MYOLP Memberships
Idiot's Guide to Excel
Volume Discounts
Payment Info
Terms of Sale
Gift CDs
Live Chat
General Info
Support Policy
Contact Form
Email Us
Mailing Address
Phone Number
Fax Number
Course Survey
Facebook    Twitter

Google Plus    LinkedIn

Blog RSS Feed    YouTube Channel
Richard Rost Microsoft MVP