ragazzi sto facendo due reader annidati....
mi da un errore assurdo sapete dirmi dove posto il codice
codice:Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim sql As String sql = "select * from foto where cartella='frontale_a' " Dim di As New IO.DirectoryInfo(Server.MapPath("obliqua_r")) Dim myconnection As OleDbConnection Dim mycommand As OleDbCommand Dim myreader As OleDbDataReader myconnection = New OleDbConnection myconnection.ConnectionString = ConfigurationManager.ConnectionStrings("fotoConnectionString").ConnectionString mycommand = New OleDbCommand mycommand.CommandText = sql mycommand.CommandType = CommandType.Text mycommand.Connection = myconnection mycommand.Connection.Open() myreader = mycommand.ExecuteReader() 'mycommand.Connection.Close() Do While myreader.Read Response.Write("pipoo") Dim sql1 As String = "select top 1 * from foto where cartella='frontale_r' and eseguito=0 order by idfoto desc" 'Dim myconnection1 As OleDbConnection Dim mycommand1 As OleDbCommand Dim myreader1 As OleDbDataReader 'myconnection1 = New OleDbConnection 'myconnection1.ConnectionString = ConfigurationManager.ConnectionStrings("fotoConnectionString").ConnectionString mycommand1 = New OleDbCommand mycommand1.CommandText = sql1 mycommand1.CommandType = CommandType.Text mycommand1.Connection = myconnection mycommand1.Connection.Open() myreader1 = mycommand1.ExecuteReader() mycommand1.Connection.Close() Loop end sub
errore:
aiutooooooocodice:La connessione non è stata chiusa. Lo stato attuale della connessione è aperto. Descrizione: Eccezione non gestita durante l'esecuzione della richiesta Web corrente. Per ulteriori informazioni sull'errore e sul suo punto di origine nel codice, vedere l'analisi dello stack. Dettagli eccezione: System.InvalidOperationException: La connessione non è stata chiusa. Lo stato attuale della connessione è aperto. Errore nel codice sorgente: Riga 35: mycommand1.CommandType = CommandType.Text Riga 36: mycommand1.Connection = myconnection Riga 37: mycommand1.Connection.Open() Riga 38: myreader1 = mycommand1.ExecuteReader() Riga 39: 'mycommand1.Connection.Close()![]()
![]()

Rispondi quotando
=MaRk0n3= 