Really Relly Stuck!!!
-
hi, I am using VisualStudio2003, Access2003 Vb.Net and ADO.Net for db access. I get this message when i try to use ExecuteReader method : IErrorInfo: GetDescription failed with E_FAIL( some hexvalue ) Now i tried MSDN it says GetDescription supposed to return description of error that is generated by database. This is what I am doing: I have a table called section g_AdoCon = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=" + db) //checked the db variable, it is valid path and everything and this // conenction works in another class fine If g_AdoCon.State = ConnectionState.Closed Then g_AdoCon.Open() End If m_Command = New OleDbCommand m_Command.Connection = g_AdoCon query = "Select * from section where cls_id = 3" m_Command.CommandText = Query m_Reader = m_Command.ExecuteReader(CommandBehavior.CloseConnection) the exception is raised when m_Command.ExecuteReader is executed. Am really stuck on this, sionce MSDN didn't really help and i have no idea what that exception means. Pleas help! :((
-
hi, I am using VisualStudio2003, Access2003 Vb.Net and ADO.Net for db access. I get this message when i try to use ExecuteReader method : IErrorInfo: GetDescription failed with E_FAIL( some hexvalue ) Now i tried MSDN it says GetDescription supposed to return description of error that is generated by database. This is what I am doing: I have a table called section g_AdoCon = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=" + db) //checked the db variable, it is valid path and everything and this // conenction works in another class fine If g_AdoCon.State = ConnectionState.Closed Then g_AdoCon.Open() End If m_Command = New OleDbCommand m_Command.Connection = g_AdoCon query = "Select * from section where cls_id = 3" m_Command.CommandText = Query m_Reader = m_Command.ExecuteReader(CommandBehavior.CloseConnection) the exception is raised when m_Command.ExecuteReader is executed. Am really stuck on this, sionce MSDN didn't really help and i have no idea what that exception means. Pleas help! :((
So what was the hex value -- have you tried to look it up in the KB? How and where is m_reader declared? Have you tried putting a try -catch around the ExecuteReader and printing the error description in the catch block? dumping the stack trace? It would appear that you have only provided selected parts of your code... maybe a cut/paste of the whole thing would shed some light. Absolute faith corrupts as absolutely as absolute power Eric Hoffer All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke
-
So what was the hex value -- have you tried to look it up in the KB? How and where is m_reader declared? Have you tried putting a try -catch around the ExecuteReader and printing the error description in the catch block? dumping the stack trace? It would appear that you have only provided selected parts of your code... maybe a cut/paste of the whole thing would shed some light. Absolute faith corrupts as absolutely as absolute power Eric Hoffer All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke
"So what was the hex value -- have you tried to look it up in the KB" 0x80004005 - E_FAIL. Microsoft says underlying component did not had a specific error number for encountered error. It happens for a lot of things but nothing specific for ADO. jsut means a general failure. How ever i found a similar problem on net on this query. "Select * from mytable where language = 'EN'" The problem got solved when authormodified the query to "select * from mytable where [LANGUAGE] = 'EN'" apparently ado treated language as keyword.( thatw as the cause given ). But this dosn't work in my case and am totally lost. Rob Graham wrote: Have you tried putting a try -catch around the ExecuteReader and printing the error description in the catch block? dumping the stack trace? AI got the error message by using the try catch, so answer is yes. dumping the stack trace????dunno what u mean here. Rob Graham wrote: How and where is m_reader declared? m_reader is decalred a private member of the class in which all this is happening as Private m_Reader As OleDbDataReader Rob Graham wrote: It would appear that you have only provided selected parts of your code... maybe a cut/paste of the whole thing would shed some light. cut paste whole class??? well it never gets past this point so i dunno if pasting the rest of code is nay use at all, cuz it has nothing to do with this. :(( Randhawa
-
"So what was the hex value -- have you tried to look it up in the KB" 0x80004005 - E_FAIL. Microsoft says underlying component did not had a specific error number for encountered error. It happens for a lot of things but nothing specific for ADO. jsut means a general failure. How ever i found a similar problem on net on this query. "Select * from mytable where language = 'EN'" The problem got solved when authormodified the query to "select * from mytable where [LANGUAGE] = 'EN'" apparently ado treated language as keyword.( thatw as the cause given ). But this dosn't work in my case and am totally lost. Rob Graham wrote: Have you tried putting a try -catch around the ExecuteReader and printing the error description in the catch block? dumping the stack trace? AI got the error message by using the try catch, so answer is yes. dumping the stack trace????dunno what u mean here. Rob Graham wrote: How and where is m_reader declared? m_reader is decalred a private member of the class in which all this is happening as Private m_Reader As OleDbDataReader Rob Graham wrote: It would appear that you have only provided selected parts of your code... maybe a cut/paste of the whole thing would shed some light. cut paste whole class??? well it never gets past this point so i dunno if pasting the rest of code is nay use at all, cuz it has nothing to do with this. :(( Randhawa
since the reader is a private member, rather than a local variable, I presume you are reusing it in other functions. Did you remember to close the reader each time you were through with it (closing the connection might not be enough)? As a general rule, I create datareaders as local variables, rather than members, and close them after each use. Absolute faith corrupts as absolutely as absolute power Eric Hoffer All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke
-
since the reader is a private member, rather than a local variable, I presume you are reusing it in other functions. Did you remember to close the reader each time you were through with it (closing the connection might not be enough)? As a general rule, I create datareaders as local variables, rather than members, and close them after each use. Absolute faith corrupts as absolutely as absolute power Eric Hoffer All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke
-
yeah it's getting closed after am done with it, every time. Actually it has never reached to the closing point yet, since the executereader never got executed since i wrote it.
is the datareader null, after the execute attempt? You don't close it in a finally block to insure it is closed even if an exception is thrown? (the fact that it thew an exception doesn't necessarily mean that it is properly closed...) Have you tried creating the reader as a local variable inside the function? I'n not sure why you chect the connection state to see if it is closed before trying to open it, since you just created it with a New...hve you single stepped the code to see if the connection really gets opened? Absolute faith corrupts as absolutely as absolute power Eric Hoffer All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke
-
hi, I am using VisualStudio2003, Access2003 Vb.Net and ADO.Net for db access. I get this message when i try to use ExecuteReader method : IErrorInfo: GetDescription failed with E_FAIL( some hexvalue ) Now i tried MSDN it says GetDescription supposed to return description of error that is generated by database. This is what I am doing: I have a table called section g_AdoCon = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=" + db) //checked the db variable, it is valid path and everything and this // conenction works in another class fine If g_AdoCon.State = ConnectionState.Closed Then g_AdoCon.Open() End If m_Command = New OleDbCommand m_Command.Connection = g_AdoCon query = "Select * from section where cls_id = 3" m_Command.CommandText = Query m_Reader = m_Command.ExecuteReader(CommandBehavior.CloseConnection) the exception is raised when m_Command.ExecuteReader is executed. Am really stuck on this, sionce MSDN didn't really help and i have no idea what that exception means. Pleas help! :((
Well first of all it's very common to use ACCESS keywords as fields or tables names and cause the ACCESS to do something strange!!! Try "SELECT * FROM [Section] WHERE [cls_id]=3" instead. Second,Why are you using CommandBehavior.CloseConnection? if you want to close your connection you can do it using connection object itself(I'm not familiar with CommandBehavior but I prefer to do one job at a time ;) first create the reader then close the connection)
-
Well first of all it's very common to use ACCESS keywords as fields or tables names and cause the ACCESS to do something strange!!! Try "SELECT * FROM [Section] WHERE [cls_id]=3" instead. Second,Why are you using CommandBehavior.CloseConnection? if you want to close your connection you can do it using connection object itself(I'm not familiar with CommandBehavior but I prefer to do one job at a time ;) first create the reader then close the connection)