I have a website deployed on my localhost throuhg IIS. I thought everything was fine until I tried two clients browsing site simultaneously. Whenever they click a button that will do SELECT commands to my database(Menu.mdb), an error will occur. Right now
the error varies with one "dbconn.open" in red highlights and another is "Menucategory.DataBind()" in red highlights too. Any solution to this that I can do? I can't dispose access and try to replace it with sqlite or others, because tommorrow's our deadlin.
Please help me. I really need help. i'm crying right now LOL. Thank you very much. :)
As so nicely stated by another user in this forum (http://forums.asp.net/post/4812985.aspx), you'll need to provide some code as the ASP.NET Forums crystal ball isn't working today.
As much as I want to provide the codes, I don't know which to post here. I think it wasn't about the code. It's something about the access database? It cannot be read by multiple users at one time? I hope I'm wrong because it will really ruin my life right
now. But I'll try to post here some codes later.
Private Sub dbcon()
dbconn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & Server.MapPath("database/" & "Menu.mdb")) dbconn.Open()<----
End Sub
javacookies
Member
16 Points
11 Posts
Error when two clients access database
Feb 12, 2012 07:50 AM|LINK
I have a website deployed on my localhost throuhg IIS. I thought everything was fine until I tried two clients browsing site simultaneously. Whenever they click a button that will do SELECT commands to my database(Menu.mdb), an error will occur. Right now the error varies with one "dbconn.open" in red highlights and another is "Menucategory.DataBind()" in red highlights too. Any solution to this that I can do? I can't dispose access and try to replace it with sqlite or others, because tommorrow's our deadlin. Please help me. I really need help. i'm crying right now LOL. Thank you very much. :)
hans_v
All-Star
35986 Points
6550 Posts
Re: Error when two clients access database
Feb 12, 2012 08:05 AM|LINK
As so nicely stated by another user in this forum (http://forums.asp.net/post/4812985.aspx), you'll need to provide some code as the ASP.NET Forums crystal ball isn't working today.
javacookies
Member
16 Points
11 Posts
Re: Error when two clients access database
Feb 12, 2012 08:31 AM|LINK
javacookies
Member
16 Points
11 Posts
Re: Error when two clients access database
Feb 12, 2012 08:38 AM|LINK
Private Sub dbcon()
dbconn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & Server.MapPath("database/" & "Menu.mdb"))
dbconn.Open()<----
End Sub
mdbcategory.DataFile = Server.MapPath("database/" & "Menu.mdb")
mdbcategory.SelectCommand = "SELECT category FROM Category"
mdbcategory.DataSourceMode = SqlDataSourceMode.DataSet
menucat.DataSource = mdbcategory
menucat.DataTextField = "category"
menucat.DataBind()
menucat.Width = 300
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Error when two clients access database
Feb 14, 2012 12:35 AM|LINK
Hello javacookies:)
Try to use "using……" block instead and immediately release the memory taken by the OleDbConnection:
using(OleDbConnection con = new OleDbConnection("……")) { …………………… con.Close(); }