Answered by:
Error when two clients access database

Question
-
User1680653135 posted
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. :)
Sunday, February 12, 2012 3:50 AM
Answers
-
User3866881 posted
Hello javacookies:)
Try to use "using……" block instead and immediately release the memory taken by the OleDbConnection:
using(OleDbConnection con = new OleDbConnection("……")) { ……………………
con.Close(); }- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, February 13, 2012 8:35 PM
All replies
-
User-1199946673 posted
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.
Sunday, February 12, 2012 4:05 AM -
User1680653135 posted
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.Sunday, February 12, 2012 4:31 AM -
User1680653135 posted
Private Sub dbcon()
dbconn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & Server.MapPath("database/" & "Menu.mdb"))
dbconn.Open()<----
End Submdbcategory.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 = 300Sunday, February 12, 2012 4:38 AM -
User3866881 posted
Hello javacookies:)
Try to use "using……" block instead and immediately release the memory taken by the OleDbConnection:
using(OleDbConnection con = new OleDbConnection("……")) { ……………………
con.Close(); }- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, February 13, 2012 8:35 PM