473,395 Members | 1,681 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Retrieving data from ACCESS database

Hi,
I have a sample ASP code which should get the records from a table in ACCESS database. However, while running the page I am getting the following error:

"Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver] The Microsoft Jet database engine cannot open the file '(unknown)'. It is already opened exclusively by another user, or you need permission to view its data."

The code which I have is:

<%
Dim rs
Set rs = Server.CreateObject ("ADODB.Recordset")

rs.Open "My Table", "DSN=My Database"

While Not rs.EOF
Response.Write "ID : " & rs("id") & "<br>"
Response.Write "First Name : " & rs("first_name") & "<br>"
Response.Write "Last Name : " & rs("last_name") & "<br>"
Response.Write "<br>"

rs.MoveNext
Wend

rs.Close
Set rs = Nothing
%>



Can anyone please help me rectify this??

Thanks,
deep2389
Sep 24 '07 #1
2 3246
shweta123
692 Expert 512MB
Hi,

Please check if the table you are updating or database(.mdb file) is opened
previously. Close the database in order to remove the error.
Sep 24 '07 #2
jhardman
3,406 Expert 2GB
deep,

do you have a database connection object? (it isn't in the code listed above) I think your "set rs..." line might be technically incorrect without it. The syntax should be something like this:
Expand|Select|Wrap|Line Numbers
  1. Dim rs, conn
  2.     set conn = server.createobject("ADODB.Connection")
  3.     conn.open "DSN=myDatabase"
  4.     Set rs = Server.CreateObject ("ADODB.Recordset")
  5.     rs.Open "SELECT * FROM myTable", conn
I always do something more like this. I realize that there are potentially many different ways to do this, but I get few errors connecting this way. Let me know if this helps.

Jared
Sep 24 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Alistair | last post by:
Hi all, I am creating a database based site that keeps track of books, who has read them and the comments they have. After a little help in M.P.I.asp.DB I managed to create a database (access...
6
by: Dave Hopper | last post by:
Hi I am using the following SQL to retrieve a value in a list box using a unique ID held in the list box call cntID. The list box is used on an order form to list appointments that have been...
6
by: Dean Slindee | last post by:
Does anybody have an actual example of retrieving an Image data type column from a SQL Server table using a dataset (not a datareader)? I would like to see the statements that would move the...
2
by: RSH | last post by:
I am struggling a bit trying to get at all of the Table names in a given Access database. I have the code below which should be retrieving the information...i am just having a bit of trouble...
0
by: kid4rilla | last post by:
I can successfully write the binary data to an image data type, and successfully retrieve it, but when I attempt to play the file in media player after retrieving it, I get the file type isn't...
0
by: Andy | last post by:
Hi All. I'm working for a company that has set out a guideline for retrieving data from a database. Nobody can explain to me the reason for the following. When retrieving a set of records...
1
by: jimmyfo | last post by:
Hi, I recently wrote an ASP.Net web application in VS2005 and published (using VS2005 Publish feature) it to a relatively clean machine with ASP.Net 2.0 and MDAC 2.8 installed on it. However, when...
11
by: Nemisis | last post by:
Hi everyone, sorry if this post gets really long, i just wanna make sure i fully explain what i am trying to do. I am new to OOP and .net 2.0, so if this is obvious, i am sorry. I have wrote a...
1
by: Chris | last post by:
Hi, I'm using the following code DataTable tables = ((OleDbConnection)oleconn).GetOleDbSchemaTable( OleDbSchemaGuid.Tables, new object { null, null, null, "TABLE" }); foreach (DataRow r in...
4
by: drt | last post by:
NEDERLANDS: Hallo, Ik heb eigen functies gemaakt in access, die werken perfect in de access query. Zodra ik echter vanuit excel een draaitabel maakt naar de access query (als een externe...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.