ODBC: Query is too complex
Dennis W. Tan -- dennis@ny.amarex.com Thursday, March 06, 1997 Environment: Win 95, NT 4.0, VC++ 4.2-flat Hi: I have an application that used odbc driver to browse for paradox = database files. Everything works fine except that odbc won't let me = update or delete records. It gives me error: Query is too complex. So, = I went to the on line odbc bug list and found that it is a bug in mfc = odbc design; it won't accept when a database has more than 40 columns, = which is true in my case. Now my question is, how can I work around = this without reducing my database column size ? I've tried to declare my derived CRecordSet class to be dynaset, and = odbc throws an exception on Open function of my CRecordSet class and the = error message says "no data truncated" ?=20 Any help is really appreciated !!! Dennis Tan Software Engineer Amarex Technology Inc. e-mail: dennis@amarex.com
Ajay K Sanghi -- sanghi@giasdl01.vsnl.net.in Saturday, March 08, 1997 [Mini-digest: 2 responses] Hi! I agree with you that this is a bug in mfc's CRecordset class which is unable to handle more than 40 fields in a table . Well .. there is a get arround for this . As you need to just delete and update the records you need not use Crecordset . You can do it with CDatabase and fire the SQL to Edit or Update the table you want to use . CDatabase is capable of handling more than 40 fields . I have updated tables with 75 fields in it using CDatabase::ExecuteSQL() . Hope this solves your problem Bye! Aditya Sanghi On Thu, 6 Mar 1997, Amarex PC wrote: > Environment: Win 95, NT 4.0, VC++ 4.2-flat > > Hi: > I have an application that used odbc driver to browse for paradox database files. Everything works fine except that odbc won't let me update or delete records. It gives me error: Query is too complex. So, I went to the on line odbc bug list and found that it is a bug in mfc odbc design; it won't accept when a database has more than 40 columns, which is true in my case. Now my question is, how can I work around this without reducing my database column size ? > I've tried to declare my derived CRecordSet class to be dynaset, and odbc throws an exception on Open function of my CRecordSet class and the error message says "no data truncated" ? > Any help is really appreciated !!! > > Dennis Tan > Software Engineer > Amarex Technology Inc. > e-mail: dennis@amarex.com > > > > -----From: Lior Messinger <100274.2607@CompuServe.COM> Hi, We have encountered many problems with CReordset and decided to leave the CRecordSet's updates. We have derived a class from CRecordSet, and replaced the Update/Insert functions with our own code which calls the raw SQL functions. Our code never does positioned updates (update on the current record), but always updates with a where clause. If your driver supplies an internal id for each record (our does - it's Intersolv) then you ca mimic positioned updates. regards, Lior Messinger. Hi: I have an application that used odbc driver to browse for paradox = database files. Everything works fine except that odbc won't let me = update or delete records. It gives me error: Query is too complex. So, = I went to the on line odbc bug list and found that it is a bug in mfc = odbc design; it won't accept when a database has more than 40 columns, = which is true in my case. Now my question is, how can I work around = this without reducing my database column size ? I've tried to declare my derived CRecordSet class to be dynaset, and = odbc throws an exception on Open function of my CRecordSet class and the = error message says "no data truncated" ?=20 Any help is really appreciated !!! Dennis Tan Software Engineer Amarex Technology Inc. e-mail: dennis@amarex.com
Xiangyang Sean Liu -- seanliu@oscsystems.com Tuesday, March 11, 1997 Using CDatabse::ExecuteSQL may cause problems that are hard to detect. For example, if you want to set field F in table T to value V and field F is of type SQL_CHAR. So you build a SQL string like the following 'update T set F = V where ... ' and pass it into CDatabse::ExecuteSQL as the argument. If the value V itself contains a single quote character ('), the call will fail because the string you passed is invalid. But no exception will be thrown. Even if you checked the return value of ExecuteSQL and found it wasn't executed successfully, what can you do about it? Ask your user not to use certain characters in any character field? --- Xiangyang Liu P.S. By the way, I am talking about VC++ 1.52 (working with Sybase 11). >>> Ajay K Sanghi03/08/97 01:37pm >>> [Mini-digest: 2 responses] Hi! I agree with you that this is a bug in mfc's CRecordset class which is unable to handle more than 40 fields in a table . Well .. there is a get arround for this . As you need to just delete and update the records you need not use Crecordset . You can do it with CDatabase and fire the SQL to Edit or Update the table you want to use . CDatabase is capable of handling more than 40 fields . I have updated tables with 75 fields in it using CDatabase::ExecuteSQL() . Hope this solves your problem Bye! Aditya Sanghi On Thu, 6 Mar 1997, Amarex PC wrote: > Environment: Win 95, NT 4.0, VC++ 4.2-flat > > Hi: > I have an application that used odbc driver to browse for paradox database files. Everything works fine except that odbc won't let me update or delete records. It gives me error: Query is too complex. So, I went to the on line odbc bug list and found that it is a bug in mfc odbc design; it won't accept when a database has more than 40 columns, which is true in my case. Now my question is, how can I work around this without reducing my database column size ? > I've tried to declare my derived CRecordSet class to be dynaset, and odbc throws an exception on Open function of my CRecordSet class and the error message says "no data truncated" ? > Any help is really appreciated !!! > > Dennis Tan > Software Engineer > Amarex Technology Inc. > e-mail: dennis@amarex.com > > > > -----From: Lior Messinger <100274.2607@CompuServe.COM> Hi, We have encountered many problems with CReordset and decided to leave the CRecordSet's updates. We have derived a class from CRecordSet, and replaced the Update/Insert functions with our own code which calls the raw SQL functions. Our code never does positioned updates (update on the current record), but always updates with a where clause. If your driver supplies an internal id for each record (our does - it's Intersolv) then you ca mimic positioned updates. regards, Lior Messinger. Hi: I have an application that used odbc driver to browse for paradox = database files. Everything works fine except that odbc won't let me = update or delete records. It gives me error: Query is too complex. So, = I went to the on line odbc bug list and found that it is a bug in mfc = odbc design; it won't accept when a database has more than 40 columns, = which is true in my case. Now my question is, how can I work around = this without reducing my database column size ? I've tried to declare my derived CRecordSet class to be dynaset, and = odbc throws an exception on Open function of my CRecordSet class and the = error message says "no data truncated" ?=20 Any help is really appreciated !!! Dennis Tan Software Engineer Amarex Technology Inc. e-mail: dennis@amarex.com
Become an MFC-L member | Вернуться в корень Архива |