MSDE - Error - ExecuteReader: CommandText property has not been initialized
Posted on 2005-04-28
"An unhandled exception of type 'System.InvalidOperationException' occurred in system.data.dll
Additional information: ExecuteReader: CommandText property has not been initialized"
Very confusing to me, as I am new to this database business!
here's the code: The error is reached on the ExecuteReader() line.
startTime = DateTime.Now
results.Text = results.Text & _
"SQL ---- 6 queries of 6 stocks between 85 & 04: " & vbCrLf
Dim connect_string As String = "User Id=sa;Password=password;Data Source=ULTRA\NET"
db_connection = New SqlConnection(connect_string)
Dim sql_command As New SqlCommand
sql_command.CommandType = CommandType.StoredProcedure
sql_command.Connection = db_connection
Dim Par As SqlParameter = New SqlParameter("@symbol", SqlDbType.VarChar, 6)
Par.Value = Trim("INTC")
SqlDR = sql_command.ExecuteReader()
Dim s As String
s = dr(0)
f = dr(1)
My Stored Procedure looks like this in Enterprise Manager:
"CREATE PROCEDURE prs_GetData
SELECT * FROM SOMETHINg WHERE SYMBOL = @symbol
Any ideas? I imagine I'm missing a line of code in the ExecuteReader() area