I have wrote a simple script were you click a button and the button calls a method which does a select statement and then in a loop inserts the results in a table ebfore closing the connection. This works using localhost but as soon as I upload it and try it there I get the following error:
However with it being a compiler error I cannot see how it could work on my local machine rather than online. I also dont have any datareaders open. Here is the method (without try..catch etc):
Any help appreciated, this is doing my head in and ive found nothing on the net etc..
Code:
There is already an open DataReader associated with this Connection which must be closed first
However with it being a compiler error I cannot see how it could work on my local machine rather than online. I also dont have any datareaders open. Here is the method (without try..catch etc):
Code:
Sub getEmail(ByVal s As Object, ByVal E As EventArgs)
Dim queryString As String = "select statement"
objCmd = New OleDbCommand
objCmd.CommandText = queryString
objCmd.Connection = objConn
Dim dbParam_tutorialID As
System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam_tutorialID.ParameterName = "@tutorialID"
dbParam_tutorialID.Value = Session("sessionTutorialID")
dbParam_tutorialID.DbType = System.Data.DbType.Int32
objCmd.Parameters.Add(dbParam_tutorialID)
objConn.Open()
objRdr = objCmd.ExecuteReader()
While objRdr.Read()
objCmd = New OleDbCommand("INSERT INTO ABSENTEE(absenteeEmail) VALUES (@absenteeEmail)", objConn)
objCmd.Parameters.Add("@studentEmail", objRdr.Item("studentEmail"))
objCmd.ExecuteNonQuery()
End While
objRdr.Close()
objConn.Close()
End Sub
Any help appreciated, this is doing my head in and ive found nothing on the net etc..