Author | Topic: ODBC Append error, cursortype issue | |
---|---|---|
Rex Jackson | ODBC Append error, cursortype issue on Tue, 21 Oct 2014 00:03:54 +0200 I am using ODBC to connect to an Access database. Then I use SqlStmtExec() passing a SQL select statement and the session object returned when connecting to the database. This results in a recordset which acts like a workarea with an alias equal to the name of the table from which the data were selected. This is working well up to a point. However when I add a record - via (alias)- >(DbAppend()) - and assign values to fields in the new record, the table on the server is updated, but the local recordset is not. The only way I have found to keep the recordset and database in sync is to reissue the query, but that is unacceptable in my app because to the delay this creates. I understand that the recordset is managed by the ODBC driver, even though it appears as a normal workarea. It has been suggested that my problem is due to the type of cursor used by ODBC when the recordset is opened. I don't know if this is the case, and I haven't been able to experiment with different cursortypes because there is no evident way to do that with Xbase 2.0 ODBC. I think this should be a feature -- not only to solve my problem but for other reasons, as well. From what I read online, the cursortype is an attribute of the recordset. So you can't set it by configuring the DSN or through a parameter passed in a driver connection string, as was also suggested to me. I think it would be best in general if DbAppend() first updated the local recordset, followed by some type of commit or update command to update the server. I found the SqlStmtExec() function in sqlcmd.ch, but I don't see documentation for it in the help. If it already has parameters for cursortype and concurrency, that would be helpful. It would be nice to be able to specify the alias too. | |
Rex Jackson | notifications on Tue, 21 Oct 2014 00:04:17 +0200 | |
Andreas Herdt | Re: ODBC Append error, cursortype issue on Wed, 22 Oct 2014 15:51:21 +0200 Hello Mr Jackson, Please have a look in the section of the help file that covers the ODBCDBE. In "Technical Reference" -> "Configuration using DacSession:setProperty()" you get a glue how to configure the cursor type active for the session after is has been established. With my best regards, Andreas Herdt Alaska Software -------------------------------------------------------------------- Technical Support: support@alaska-software.com News Server: news.alaska-software.com Homepage: http://www.alaska-software.com WebKnowledgeBase: http://www.alaska-software.com/kbase.shtm Fax European Office: +49 (0) 61 96 - 77 99 99 23 Fax US Office: +1 (646) 218 1281 -------------------------------------------------------------------- "Rex Jackson" wrote in message news:5b6984c$1e309d30$42746@news.alaska-software.com... >I am using ODBC to connect to an Access database. Then I use SqlStmtExec() > passing a SQL select statement and the session object returned when > connecting > to the database. This results in a recordset which acts like a workarea > with > an alias equal to the name of the table from which the data were selected. > > This is working well up to a point. However when I add a record - via > (alias)- >>(DbAppend()) - and assign values to fields in the new record, the table on > the server is updated, but the local recordset is not. The only way I have > found to keep the recordset and database in sync is to reissue the query, > but > that is unacceptable in my app because to the delay this creates. > > I understand that the recordset is managed by the ODBC driver, even though > it > appears as a normal workarea. It has been suggested that my problem is > due to > the type of cursor used by ODBC when the recordset is opened. I don't > know if > this is the case, and I haven't been able to experiment with different > cursortypes because there is no evident way to do that with Xbase 2.0 > ODBC. I > think this should be a feature -- not only to solve my problem but for > other > reasons, as well. > > From what I read online, the cursortype is an attribute of the recordset. > So > you can't set it by configuring the DSN or through a parameter passed in a > driver connection string, as was also suggested to me. > > I think it would be best in general if DbAppend() first updated the local > recordset, followed by some type of commit or update command to update the > server. > > I found the SqlStmtExec() function in sqlcmd.ch, but I don't see > documentation > for it in the help. If it already has parameters for cursortype and > concurrency, that would be helpful. It would be nice to be able to > specify > the alias too. |