Problem getting query to work
I'm trying to write access a SQL Server 2005 database from a Visual Studio 2005 Beta 2 web service. I'm having a problem getting it to work.
The database contains a sample table (States) of the states names, defined as:
StateID tinyint
StateName nchar(15)
The code is:
Dim ConnStr As String
Dim CmdString As String
Dim sqlDA As Data.SqlClient.SqlDataAdapter
Dim ds As Data.DataSet
ConnStr = "Data Source=Beta2Test;Initial Catalog=TestProject;Integrated Security=True"
CmdString = "SELECT * FROM States"
sqlDA = New Data.SqlClient.SqlDataAdapter(CmdString, ConnStr)
ds = New Data.DataSet()
sqlDA.Fill(ds, "States")
Return ds
The data source line I copied from the database's Data Source property. The exception is claiming a timeout. The database and web service is on the same machine. I don't think the timeout is the actually issue, but the result of some other problem, which I'm not spotting. Anyone see what I'm missing?
I'm running the SQL Server CTP June 2005 Developer Edition, Visual Studio 2005 Beta 2, and Windows 2003 Server w/SP1.
Richard
Here the exception message being returned:
System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Connect(Boolean& useFailoverPartner, Boolean& failoverDemandDone, String host, String failoverPartner, String protocol, SqlInternalConnectionTds connHandler, Int64 timerExpire, Boolean encrypt, Boolean integratedSecurity, SqlConnection owningObject, Boolean aliasLookup)
at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)
at TestWS.GetStates() in c:\inetpub\wwwroot\TestProject\App_Code\TestWS.vb:line 105

