Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connection to DataBase

Status
Not open for further replies.

chris77

Technical User
May 6, 2003
5
DE
I'm trying to make a connection to a MS Access database, so I can display, add and modify new records. The first step I took was just to set up a connection, but I keep on getting this error 'Server'is undefined. Here is the code, is there anything missing, or is this even possible.

<SCRIPT LANGUAGE=&quot;JavaScript&quot;>

function openDatabase()
{
connect= Server.CreateObject(&quot;ADODB.Connection&quot;);
connect.Provider=&quot;Microsoft.Jet.OLEDB.4.0&quot;;
connect.Open(&quot;mydb.mdb&quot;


}
</SCRIPT>


Thanks any advance for any help I can get.
 
you can't connect to a DB client side with javascript in this manner. You will need to use server side javascript or better vbscript. ASP! I help at your own risk, if I brake it sorry! But if I fixed it, let me know.[thumbsup2]
admin@onpntwebdesigns.com
 
I'm not familiar with server side javascript, do you have some sample that can take a look at.
 
I recommened using vbscript for asp. here's a example
<%
Dim objConn 'declare your variable to hold your connection
Set objConn=Server.CreateObject(&quot;ADODB.Connection&quot;)
connectionString=&quot;DBQ=&quot; & Server.MapPath(&quot;NameOfDatabase.mdb&quot;)
objConn.open &quot;DRIVER={Microsoft Access Driver (*.mdb)}; &quot; & connectionString
%>

you can read about using server side javascript here
this way is far longer and more prone to errors though.


do you have asp available to you?? I help at your own risk, if I brake it sorry! But if I fixed it, let me know.[thumbsup2]
admin@onpntwebdesigns.com
 
I tried this and all I get is my code displayed back in the screen. I'm curretnly working on a workstaion with NT 4, but my admin gave me administrator privilage along with giving me server permision and special directory in the webserver that is running MS IIS 4.3
 
I tried this and all I get is my code displayed back in the screen. I'm curretnly working on a workstaion with NT 4, but my admin gave me administrator privilage along with giving me server permision and special directory in the webserver that is running MS IIS 4.3
 
you need to place the page (.asp) in the folder in order to run asp pages with IIS.
go to administrative tool
then click IIS (internet information services)
place the page into the folder and then try running it by typing in your browser I help at your own risk, if I brake it sorry! But if I fixed it, let me know.[thumbsup2]
admin@onpntwebdesigns.com
 
I do not have the internet information service option under administrative tools. Does that mean I am not properly set up in the web server.
 
yup! you either need to download the NT service pack 4.0 or have it installed via add/remove programs and the win installation cd I help at your own risk, if I brake it sorry! But if I fixed it, let me know.[thumbsup2]
admin@onpntwebdesigns.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top