"INVALID ATTEMPT TO READ WHILE READER IS CLOSED"
Is their anyone that can see something in my code that I'm missing.
Thank you.
Or any suggestions
Try
Dim myreader As OleDb.OleDbDataReader Dim mycomm As New OleDb.OleDbCommand("SELECT * from job where project = '" & str2 & "'", conn) If conn.State = ConnectionState.Open Thenconn.Close()
End Ifconn.Open()
myreader = mycomm.ExecuteReader(CommandBehavior.CloseConnection)
While myreader.Read()str = myreader("jobid")
mdlinstallair.jobval() = str
ListBox1.Visible =
FalseListBox2.Visible =
True End Whilemyreader.Close()
Catch ex As ExceptionMessageBox.Show("THIS ONE ASWELL" & ex.Message)
End Tryconn2.Close()
conn.Close()

Problems with DataReader!!
Eadd
coloradovista
Mynor Ivan Muralles MSFT
Isaac Strack
First, I don't understand why you're closing the connection and reopening it... are you trying to purge a previous DataReader
Next, before you try to reference a DataReader, you need to determine if there are rows being returned.
If Dr.HasRows Then...
hth
fap99
AlinaMaria
nope, no luck sorry.
I saw someone with the same prolems on some of the other forums, but now one was able to help him.
That's why I pop in here.
To see if some of there's any advanced hardcore programmer some where that might be able to help me.
VistaGeek
The way I program database operations like this is:
SqlConnection conn = new SqlConnection("Insert Connectionstring Here");
SqlCommand cmd = new SqlCommand("Insert command text here", conn);
cmd.CommandType = CommandType.Text;
SqlDataReader reader = null;
try
{
conn.Open();
reader = cmd.ExecuteReader();
while(reader.Read())
{
}
reader.Close();
conn.Close();
}
catch(SqlException ex)
{
// Handle the Exception
}
finally
{
// Detect open connections and readers and close them
}
I usually don't do any UserInterface actions in the database operations.