Code Bank
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingCode Bank

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old January 20th, 2006, 09:20 AM
minus4's Avatar
minus4 minus4 is offline
short arse brainiac
ASP Free Novice (500 - 999 posts)
 
Join Date: Jun 2005
Location: Leeds UK
Posts: 577 minus4 User rank is Sergeant Major (2000 - 5000 Reputation Level)minus4 User rank is Sergeant Major (2000 - 5000 Reputation Level)minus4 User rank is Sergeant Major (2000 - 5000 Reputation Level)minus4 User rank is Sergeant Major (2000 - 5000 Reputation Level)minus4 User rank is Sergeant Major (2000 - 5000 Reputation Level)minus4 User rank is Sergeant Major (2000 - 5000 Reputation Level)  Folding Points: 800 Folding Title: Novice Folder
Time spent in forums: 4 Days 1 h 39 m 38 sec
Reputation Power: 30
Send a message via MSN to minus4
Auto build connstring for access databases

place these pages in the folder that holds your database, if within webroute. and it will build your database string for you.

the page
Code:
<%
dim strPath, strdbname ' define the variables
strdbName = Trim(Request.form("database")) 'ask for database name from the form
if strdbName <> "" then ' if the text box has something written
	strPath = Replace(Request.ServerVariables("PATH_TRANSLATED"), "getstring.asp",strdbName) 'we get the path of the database, then place it in a string
end if %>
<html>
<head>
<title>were is my database</title>
</head>
<body>
<font face="Verdana,Arial,Helvetica" size="4">
<strong>database strings</strong></font><font face="Verdana,Arial,Helvetica" size="2"><b><%
if strdbName = "" then 'box was empty
response.write ("your must specify database name.mdb")
 else
 %>
    </b>
    <p><b>Physical Path to Database: <%=strPath%></b></p>
    <p><b>Example strConnString:</b></p>
		<p><b>for access 97, 2000 and up</b></p>
		<nobr><p><b>strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=<%=strPath%>" '## MS Access 2000</b></p></nobr>
		<b>
		<br /></b><p><b>if you cant get the above 
to work, then below is your next option</b></p>
		<nobr><p><b>strConn = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=<%=strPath%>" '## MS Access 97</b></p></nobr>
		<p></p>
<p></p>
<p></p>
<p><br>
If none work for you (strange) then you can use a DNS</p>
		</font>
		</body>
		</html>
		<% End IF %>


the form page

Code:
<html>
<head>
<title>database name including</title>
</head>

<body>

<form method="POST" action="getstring.asp">
	<p>database name including .mdb <input type="text" name="database" size="20"></p>
	<p>&nbsp;</p>
	<p><input type="submit" value="Submit" name="B1"></p>
</form>

</body>

</html>


the asp page is to be saved as getstring.asp
unless you change the action on the form
hope this helps with novice, and first time database users and asp

Last edited by minus4 : January 20th, 2006 at 09:41 AM.

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingCode Bank > Auto build connstring for access databases


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT