|
-
Apr 27th, 2003, 06:18 AM
#1
Thread Starter
Frenzied Member
Datagrid, 'Can't open database'
Hello
I am writing database application in ASP.Net, but l can the following error message when l try and run the program. I am loading a datagrid with the contents of the database
C:\Surgery.mdb. It is already opened by another user, or you need permission to view its data.
My code l am using is the following
Code:
daOwners.Fill(dsOwners) 'Fill the dataset with the contents of the database
grdOwners.DataSource = dsOwners 'Put the data from the dataSet into the datagrid
grdOwners.DataBind() 'Bind the contents
I get the error message on the first line "daOwners.Fill(dsOwners)"
Hope someone can help me
Many thanks in advance
Steve
-
Apr 27th, 2003, 07:08 PM
#2
New Member
Steve,
What connection string do you use? Is it something like -
"Provider=Microsoft.Jet.OleDb.4.0;DataSource=your path/surgery.mdb;" ?
-
Apr 28th, 2003, 03:16 AM
#3
Thread Starter
Frenzied Member
Hello
Yes the connection string is something like that. But have used the same connections for building windows forms, and the connection works fine, it is only when building a ASP application, that the problem occurs.
Any ideas on what it can be.
Thanks for you help.
-
Apr 28th, 2003, 05:00 AM
#4
Frenzied Member
You have to grant read and write permissions to IUSR_Computername user for the folder where the database resides.
Last edited by Lunatic3; Apr 28th, 2003 at 05:22 AM.
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
-
Apr 28th, 2003, 05:13 AM
#5
Thread Starter
Frenzied Member
Hello Lunatic3
Thanks for you response.
But i am not sure how to grant read and write permissions to IUSER_COMPUTERNAME user on the folder where the database is located.
Can you give me a quick step by step
Many thanks
-
Apr 28th, 2003, 05:21 AM
#6
Frenzied Member
If you are using Windows XP, first goto My Computer>Tools>Folder Options>View>
Then Scroll down and the remove thel ast check that reads : Use simple File Sharing, If not unchecked already.
From here both XP and 2000 are almost the same but i tell you about XP cause i dont have 2000 right here to tell you exactly.
Right click on the folder where your databse is and goto Properties>Secuity
There Select Add>Advanced>Find Now
and locate IUSR_Computername (computer name is name of your computer) and add it to the list of users, then check the read, write permissions.
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
-
Apr 28th, 2003, 05:30 AM
#7
Thread Starter
Frenzied Member
Thank for your help
I do have windows XP Pro, but can't check now as l am in a internet cafe.
Just a quick question, why do l have to grant read and write permissions. l have done this many time, but never needed to do that. Is it because l am developing a ASP.Net application and not a standard windows application. If so why is this?
Thanks for you help
Steve
-
Apr 28th, 2003, 05:49 AM
#8
Frenzied Member
It seems that all the time you have done this before you have used the account with administrator privilages that has read and write permission on almost all of the folders so you have not noticed a problem.
When you work with a database (in this case Access and Jet) you need to give the database itself read and write permission for the user that is going to work for it so it can manipulate the data.
However when the progrma connects to the database it makes a database lock file that will be located on the same folder as the database and after connection is closed it is deleted. So that folder need write and read and delete permissions for that user too.
By granting the folder the specific rights and let it to propagate to child items (items in the folder) you can gain what i told you above.
Keep in mind that when an ASP or ASP.NET application runs its the IUSR account that tries to run it, so you need to grant those rights to this specific user.
Last edited by Lunatic3; Apr 29th, 2003 at 10:25 AM.
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
-
Apr 29th, 2003, 07:51 AM
#9
Thread Starter
Frenzied Member
resolved
Hello
Thanks for you help, that worked fine, and for the explanation on granting user read and write permissions.
Steve
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|