Link to home
Start Free TrialLog in
Avatar of rkulp
rkulpFlag for United States of America

asked on

How Do I Debug This?

I have tested a web app and then deployed it to the site. When trying to open it I get an error that it cannot open the database.
The database is present and the path is correct.
The query is (see code snippet):

SELECT [Name] FROM [Cabinet] WHERE ([Position] = ?)

with default parameter = "District Governor"

The stack trace shows instructions leading up to the error but does not help me in determining why I cannot open the database file.  Can someone suggest how to use this to get to the why, not just the where?
From Default.aspx:
 
                        <asp:SqlDataSource ID="DGNameDataSource" runat="server" ConnectionString="data source=E:\VisualStudio2005\Projects\MD12S\App_Data\lions12s.s3db"
                            ProviderName="System.Data.SQLite" SelectCommand="SELECT [Name] FROM [Cabinet] WHERE ([Position] = ?)">
                            <SelectParameters>
                                <asp:Parameter DefaultValue="District Governor" Name="Position" Type="String" />
                            </SelectParameters>
                        </asp:SqlDataSource>
 
 
Stack Trace:
 
 
[SQLiteException (0x80004005): Unable to open the database file]
   System.Data.SQLite.SQLite3.Open(String strFilename, SQLiteOpenFlagsEnum flags, Int32 maxPoolSize, Boolean usePool) +206
   System.Data.SQLite.SQLiteConnection.Open() +2141
   System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState) +31
   System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +112
   System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +287
   System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +92
   System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1297
   System.Web.UI.WebControls.SqlDataSource.Select(DataSourceSelectArguments arguments) +19
   MD12S._Default.GetDGName() in E:\VisualStudio2005\Projects\MD12S\Default.aspx.vb:41
   MD12S._Default.Page_Load(Object sender, EventArgs e) in E:\VisualStudio2005\Projects\MD12S\Default.aspx.vb:10
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +50
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of tiagosalgado
tiagosalgado
Flag of Portugal image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Nasir Razzaq
Are you able to open the database on the development computer? It could be that the ASP.NET account does not have access permissions to the folder and drive. Try by copying the database file to the app folder.
give the annomyous access the full/required access to that drive
Avatar of rkulp

ASKER

Thanks. I should have checked that myself. Please color me embarassed.
in your question you said yourself that the database IS there at the specified path and now you accepted the answer which said database should be present at the path.
Avatar of rkulp

ASKER

I failed to notice that the path in the error message and the xml snippet was incorrect. I apologize for my error.
Avatar of rkulp

ASKER

The only resolution was to change the connection string to point to the |DataDirectory| rather than the physical path.