2014年7月13日 星期日

[RESOLVED] Gridview & Server Problem


Hi,


I have created a gridview which is connected to an access database, I want to be able to open the gridview also when the database is open ( I have already enabled the shared option in access advanced options) ,when I run the gridview on localhost the gridview
works fine with both closed and opened database, but when I run the gridview on the server it stops the gridview from opening whenever I open the database . I would appreciate if you could give me any solution.


Thanks



Seems to me that maybe you are opening the database in exclusive mode. Exclusive means no one else can connect. I think you can set the mode in MS Access to non-exclusive mode.



Do you mean by open database, opening connection to database ?




If you are doing a connection to the DB, you can set the option to not use exclusive mode in your connection string.



Also, when you populate your gridview, I strongly recommend you use a data reader to populate your gridview.



Take a look at the connection strings given at this link to compare to yours to ensure you aren't setting exclusive mode:


http://www.connectionstrings.com/access/



I have already changed the deafault open mode of the database to shared but that didn't change anything, I think it should be server security problem because the gridview is working on the localhost when database is also opened and only on the server mode
this problem arises.



Yes I mean opening connection to database.



Although Access database works, for server-side web application, I'd recommend you consider SQL Server Express edition or SQL Server Compact edition (which is also file based). That will give you more reliable and flexible data accessing support in ASP.NET
web application.


#New Embedded Database Support with ASP.NET

http://weblogs.asp.net/scottgu/archive/2010/06/30/new-embedded-database-support-with-asp-net.aspx


#Using SQL Server Compact for ASP.NET Web Applications

http://msdn.microsoft.com/en-us/library/ms247257.aspx/html


#Using SQL Server Express with ASP.NET

http://msdn.microsoft.com/en-us/library/ms247257(v=vs.100).aspx


沒有留言:

張貼留言