Last post Sep 11, 2009 03:46 PM by Mikesdotnetting
Sep 11, 2009 12:49 PM|jpoandl|LINK
I am a complete newbie using any form of Visual Web Developer. The version I am getting started with is Visual Web Developer 2008 Express w/SP1.
I followed this article that explains how to connect to a local Access DB and how to display a table using GRIDVIEW. This works great in my lab. http://msdn.microsoft.com/en-us/library/445z2s49(VS.80).aspx
I am now taking the next step..of using a copy of a real Access DB. This Access Database has some queries already writting that work fine in the AccessDB itself. The AccessDB query merges some SQL DB data with the Access DB.
Anyway, When I use Gridview to display a table or query that contains only data in the Access DB, my webpage displays correctly. (Meaning that the source table I choose does not need any further data in the SQL database...its all local to the Access DB.
In this mode, everything works great.)
However, when I try to use Gridview to display a webpage that contains a SQL query, I get this error on the webpage (note: the test query that you can try when you use AccessDataSource from the toolbox runs completely fine):
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.
[OleDbException (0x80004005): ODBC--connection to 'SQL ServerUSMEADSMSPRI' failed.]
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr) +1003520
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) +255
System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) +188
System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) +58
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) +161
System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior) +116
System.Data.OleDb.OleDbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) +4
System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +130
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.AccessDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +58
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +19
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842
Any idea of how I can fix this? My SQL server is usmeadsmspri. And I am NOT using integrated authentication for it... I have a special SQL userID that has Read Only access to the Database.
Sep 11, 2009 01:01 PMemail@example.com|LINK
I'm a bit confused over whether the datase is Access or SQL Server. My first guess is the connection string is incorrect for the deployed database, but this error basically just says that something's wrong.
Sep 11, 2009 01:18 PM|jpoandl|LINK
The database I am connecting to is an Access DB. However, within the Access DB itself, there is a query (that I am trying to use) that links data from the Access DB and an external SQL database (located on a remote server.)
The reason we are doing it this way is two fold: a- the database is a pre-existing database that people connect to already. I am just trying to display the data on a Website so in the event you don't have Access installed, you can still view the data.
b- Our users know how to write queries in Access already...if we can continue to let them do that using the Access Query Wizard, it would be a good thing for us.
1) I am using Visual Web Dev. 2008 Express. I used the Toolbox --> Data Group --> AccessDataSource to connect to the Access Database. (Note, while I setup the connection in this way, you can TEST the connection and test the query... all works fine here)
2) I then go back to Toolbox --> Data Group --> Gridview to show the connected data.
3) I hit CTRL - F5 to test the page
(Its at this time, I get the error)
Sep 11, 2009 02:10 PM|Mikesdotnetting|LINK
When you run VWD, I assume it is as an administrator, so it may have permissions that your web app hasn't. Are you using impersonation in the web app?
Sep 11, 2009 02:42 PM|jpoandl|LINK
Yes, when I run VWD on the server, I am logged in with Administrative rights (a domain user account that has local administrator rights on the Windows 2003 R2 SP2 server)
As I am new to VWD, ASP.net, and designing web pages, I am not sure if I am using Impersonation??
The Access database (which is not password protected) is located on the Web server (the same server that I mentioned above). The SQL server is a remote server and in order for the query to work, a special SQL username and password must be provided.
I have not configured this anywhere... although, at one time, I simply tried to add a system ODBC connection on the Web server for the remote SQL database.
Sep 11, 2009 03:46 PM|Mikesdotnetting|LINK
This might be a start:
http://msdn.microsoft.com/en-us/library/aa292118(VS.71).aspx. So might this for connecting directly to SQL Server: