Samson,

If your DSN isn't working quite right, you might consider a DSN-less
connection.  See if any of this will help:



In Access, create and save a query that contains:
  "SELECT distinct dept_name from campus"
Let's say you call it qry_DeptName



'The following code goes in your .asp file

'Asp helps you remember to define each variable before you use it
OPTION EXPLICIT

'The connection string
Dim strConnect
StrConnect = _
  "Driver={Microsoft Access Driver (*.mdb)}; " & _
  "DBQ=the_path_to_your_database"

'The path would be something more or less like:
'   D:\MyFolder\MySubfolder\MyDatabase.mdb
'The path needs to be the path to the database from the server's point of
view, not the path to the database from your workstation
'If you don't know the path to your database, talk to your network
administrator

'For future .asp files, read about "Server Side Includes" (SSI's)
'Maintaining the connection information above becomes a lot easier if you
use an SSI instead of putting the connection string information in every
.asp file


'The recordset
Dim obj_Recordset
Dim obj_Command

Set obj_Recordset = Server.CreateObject("ADODB.Recordset")
Set obj_Command =  Server.CreateObject("ADODB.Command")

obj_Command.ActiveConnection = strConnect

'This is the query used
obj_Command.CommandText = "qry_DeptName"

' Access queries are considered "Stored Procedures" in ASP
obj_Command.CommandType = adCmdStoredProc

Set obj_Recordset = obj_Command.Execute

'The recordset is open
'Now do some processing

'Find a record that you know exists
'If it might not exist, you need to have a test and error trap
obj_Recordset.Find "dept_name = 'Math''"

'Read a record
'Remember to dim each variable before it is used
strMyVariable = obj_Recordset("dept_name")

'Change a record
obj_Recordset("dept_name") = "Chemistry"

'Save your changes
obj_Recordset.update

'Clean up
Set obj_Rrecordset = Nothing
Set obj_Command = Nothing

HTH,

Far Farley
www.TheAccessWizard.com



-----Original Message-----
From: samson kumar [mailto:[EMAIL PROTECTED]
Sent: Monday, November 29, 2004 1:25 AM
To: [EMAIL PROTECTED]
Subject: [ASP] remote Ms-access connection help



I have placed my "campus.mdb" database in folder "database" in remotely
.please advise how i can use ms-access databases remotely?

>From the "main.asp",I am trying to get values.

set con =server.CreateObject("ADODB.Connection")
con.open "DSN=campus"
Set objrs1 = Server.CreateObject("ADODB.Recordset")
sql1="SELECT distinct dept_name from campus"

The error Im getting is.

Microsoft OLE DB Provider for ODBC Drivers error '80004005' [Microsoft][ODBC
Driver Manager] Data source name not found and no default driver specified

/campusarea/select.asp, line 11

Can you pls advice/help as I am working first time on this website.

Thank you in advance.


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

[Non-text portions of this message have been removed]







---------------------------------------------------------------------
 Home       : http://groups.yahoo.com/group/active-server-pages
---------------------------------------------------------------------
 Post       : [EMAIL PROTECTED]
 Subscribe  : [EMAIL PROTECTED]
 Unsubscribe: [EMAIL PROTECTED]
---------------------------------------------------------------------
Yahoo! Groups Links









------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/17folB/TM
--------------------------------------------------------------------~-> 

---------------------------------------------------------------------    
 Home       : http://groups.yahoo.com/group/active-server-pages
---------------------------------------------------------------------
 Post       : [EMAIL PROTECTED]
 Subscribe  : [EMAIL PROTECTED]
 Unsubscribe: [EMAIL PROTECTED]
--------------------------------------------------------------------- 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/active-server-pages/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to