Hi Everyone,

I have this problem whit my code : ExecuteReader: Connection Property has not been initialized
and i don't know why

This is my code:

Dim maximo As Integer
        Try
            oConn = New OleDb.OleDbConnection(con)
            oConn.Open() ' abrimos la base de datos
            oComn = New OleDb.OleDbCommand("Select ID_ISSUE From ISSUE")
            oRsRead = oComn.ExecuteReader() 'para leer la base de datos
            While oRsRead.Read() ' ciclo para leer la base de datos
                maximo = ("ID_ISSUE")
            End While
            oConn.Close() 'se cierra la base

        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
        MsgBox(maximo)


        MessageBox.Show(ex.Message)
    End Try
    MsgBox(maximo)

Thanks

Hi Everyone,

I have this problem whit my code : ExecuteReader: Connection Property has not been initialized
and i don't know why

This is my code:

Dim maximo As Integer
        Try
            oConn = New OleDb.OleDbConnection(con)
            oConn.Open() ' abrimos la base de datos
            oComn = New OleDb.OleDbCommand("Select ID_ISSUE From ISSUE")
            oRsRead = oComn.ExecuteReader() 'para leer la base de datos
            While oRsRead.Read() ' ciclo para leer la base de datos
                maximo = ("ID_ISSUE")
            End While
            oConn.Close() 'se cierra la base

        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
        MsgBox(maximo)


        MessageBox.Show(ex.Message)
    End Try
    MsgBox(maximo)

Thanks

i don't understand you but not is this: oComn = New OleDb.OleDbCommand

Dim oConn As New OleDb.OleDbConnection("PROVIDER=xxx;DATA SOURCE=xxx")
oComm = New OleDb.OleDbCommand(Your SQL Command Here, oConn)

oRsRead = oComm.ExecuteReader

Hope this helps, you need to include the connection in the command as above.

Cheers
Will

Thank you so much
i didn't put insede teh comand ", oConn"
:P
thanks

No Problemo
Cheers
Will

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.