CommandText not initialized?
Hi there,
I am trying to get data back from SQL but i always get this error. What does it mean and how do I sort it?
CommandText property has not been initialized
Code:
Dim SQLCommand As New SqlClient.SqlCommand
Dim sqlconn As New SqlClient.SqlConnection(ConnectionString)
sqlconn.Open()
SQLCommand.Connection = sqlconn
Dim SQLDataAdapter As New SqlClient.SqlDataAdapter
SQLDataAdapter.SelectCommand = New SqlClient.SqlCommand(query, sqlconn)
Dim SQLDataSet As New DataSet
SQLDataAdapter.Fill(SQLDataSet)
Dim SQLConnection As New SqlClient.SqlCommand(query, sqlconn)
'we have the query ready in a string
SQLCommand.ExecuteNonQuery()
after that has been solved...I would also like to know how do i display the results on the screen? (im using asp.net btw....)
Thanks :)