R
RAJ
Hi,
While connecting to a database and using ExecuteReader in my
application, I am getting the following error:
**************************************************
An Unhandled Exception of type 'System.InvalidOperation Exception'
occurred in System.Data.dll
ExecuteReader: Connection Property has not been initialized.
**************************************************
I checked the connection strings and it's correct.While debugging I
have seen the connection property details.(On Mouse Pointer).
But the connection is not opening in response to Connection.Open()
statement before invoking the ExecuteReader.
Please let me know if any body knows the resolution or suggestions.
******************************
Here is my code:
Dim strSQL As String
Dim cmdDeath As SqlClient.SqlCommand
Dim drDeath As SqlClient.SqlDataReader
strSQL = "select max(batchid) as MaxBatchID from Tablename"
'''Declared g_conDeath as public with values from strConn
cmdDeath = New SqlClient.SqlCommand(strSQL, g_conDeath)
drDeath = cmdDeath.ExecuteReader '''getting error here
**********************************************
Thanks.
While connecting to a database and using ExecuteReader in my
application, I am getting the following error:
**************************************************
An Unhandled Exception of type 'System.InvalidOperation Exception'
occurred in System.Data.dll
ExecuteReader: Connection Property has not been initialized.
**************************************************
I checked the connection strings and it's correct.While debugging I
have seen the connection property details.(On Mouse Pointer).
But the connection is not opening in response to Connection.Open()
statement before invoking the ExecuteReader.
Please let me know if any body knows the resolution or suggestions.
******************************
Here is my code:
Dim strSQL As String
Dim cmdDeath As SqlClient.SqlCommand
Dim drDeath As SqlClient.SqlDataReader
strSQL = "select max(batchid) as MaxBatchID from Tablename"
'''Declared g_conDeath as public with values from strConn
cmdDeath = New SqlClient.SqlCommand(strSQL, g_conDeath)
drDeath = cmdDeath.ExecuteReader '''getting error here
**********************************************
Thanks.