# Problems connecting to database for flash message board

**URL:** <https://forum.kirupa.com/t/problems-connecting-to-database-for-flash-message-board/128296>\
**Category:** Uncategorized\
**Created:** [November 11, 2004, 3:34am UTC](https://forum.kirupa.com/t/problems-connecting-to-database-for-flash-message-board/128296 "2004-11-11T03:34:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![staxwax](https://avatars.discourse-cdn.com/v4/letter/s/d07c76/32.png) [@staxwax](https://forum.kirupa.com/u/staxwax)\
**Post date:** [November 11, 2004, 3:34am UTC](https://forum.kirupa.com/t/problems-connecting-to-database-for-flash-message-board/128296/1 "2004-11-11T03:34:51Z")

</div>

## hi guys, a little help if you please, database work is most definitely NOT my strongpoint. anyhow i’m trying to set up this board on a new site that has to use a database folder outside the main content folders to hold an access database named ‘example.mdb’ the code states that we’re creating a ‘dsn-less’ connection… but i think i need to create a dsn connection, maybe you can see if there’s some obvious problems with the code below? … i am 2 folders deep in the main directory so i don’t think actually getting to the database file is the problem, thanks for the help! dd

\<%@Language=“VBScript”%\>  
\<%  
'================  
’ ex1-emails.asp  
’ For Flash 4  
‘================  
’ Very good practice to include this line  
Option Explicit  
’ RecordSet and Connection objects, and SQL string  
Dim oRS, oConn, strSQL  
Dim results  
Set oConn = Server.CreateObject(“ADODB.Connection”)  
Set oRS = Server.CreateObject(“ADODB.Recordset”)  
’ Make a DSN-less connection to the DB  
oConn.Open “DRIVER={Microsoft Access Driver (\*.mdb)};DBQ=” & Server.MapPath("…/…/database/example.mdb")  
’ Open our recordset accordingly  
If UCase(Request(“NameLast”)) = “” Then  
strSQL = “SELECT \* FROM Emails ORDER BY ID DESC”  
Else  
strSQL = “SELECT \* FROM Emails WHERE NameLast LIKE '” & Request(“NameLast”) & "’"  
End If  
oRS.Open strSQL, oConn, 2, 3  
’ 2 and 3 are numeric equivalents of adOpenDynamic and adLockOptimistic.  
’ These are the best choices for what we’re trying to accomplish.  
’ See ADO documentation for other cursor and lock types.  
If oRS.EOF Then  
Response.Write “success=False”  
Else  
Response.Write “success=True&results=”  
Do While Not oRS.EOF  
results = results & oRS (“NameFirst”) & " " & oRS(“NameLast”) & vbCr  
results = results & oRS(“EmailAddress”) & vbCr  
results = results & oRS(“Message”) & vbCr & “--------------------------------” & vbCrLf  
oRS.MoveNext  
Loop  
End If  
oRS.Close  
Set oRS = Nothing  
oConn.Close  
Set oConn = Nothing  
Response.Write Server.URLEncode(results)  
%\>
