Gladimir Posted August 22, 2003 Posted August 22, 2003 When I try to fill a dataset table using the SELECT statement listed below, I get the following error: Unspecified error: E_FAIL(0x80004005) Here is the relevant code: string strSelectA = null; strSelectA = "SELECT ComputerName, Domain FROM REF_CSDComputers " + "WHERE (Billable='" + true.ToString() + "')"; OleDbDataAdapter assetAdapter = new OleDbDataAdapter(strSelectA, master); try { assetAdapter.Fill(ds1, "lookup"); } finally { master.Close(); } Obviously, the error occurs when I attempt to use the Fill method of the assetAdapter. The dataset ds1 definitely exists, and in fact, there is a line of code calling the Fill method of another DataAdapter just above the assetAdapter. Any help is greatly appreciated. Quote Never ascribe to malice that which is adequately explained by incompetence. - Napoleon Bonaparte
*Experts* Nerseus Posted August 22, 2003 *Experts* Posted August 22, 2003 in fact, there is a line of code calling the Fill method of another DataAdapter just above the assetAdapter. If the line above is coded the same way, then you're passing a Closed connection to the second DataAdapter. The Finally code always runs, which is probably closing the Connection after the first use. -nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Gladimir Posted August 22, 2003 Author Posted August 22, 2003 Database Connection is OK... I double-checked on your suggestion. The Fill method checks the status of the related connection object and automatically Opens that object if it is closed. I've also tried playing with the "Billabe=" portion of the SELECT statement, including using Yes, True, and 1. Thanks for the feedback. Quote Never ascribe to malice that which is adequately explained by incompetence. - Napoleon Bonaparte
Gladimir Posted August 22, 2003 Author Posted August 22, 2003 SOLUTION... And the answer is... Place '[' and ']' brackets around the word Domain in the SELECT statement. Quote Never ascribe to malice that which is adequately explained by incompetence. - Napoleon Bonaparte
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.