vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| I am trying to implement a virtual listbox/datagrid using Sql Server and ODBC. I am attempting to use a dynamic - block cursor. The virtual and the block parts work great but the dynamic part is not working. When a record is selected from the listbox I display a dialog box that allows changes to the record. Following an "Update ... " (using a different statement), the data in the database is in fact changed but is not reflected in the listbox when the listbox is scrolled causing a new fetch containing the updated record. The select statment is a simple: "Select Col_1, Col_2, Col_3 ... from Record_A order by 2" According to the ODBC ref manual all that's required for dynamic Cursor setup are the following statement attribute setups: SQLSetStmtAttr (m_hStmt, SQL_ATTR_CURSOR_TYPE, (SQLPOINTER) SQL_CURSOR_DYNAMIC, 0); SQLSetStmtAttr (m_hStmt, SQL_ATTR_CONCURRENCY, (SQLPOINTER) SQL_CONCUR_LOCK, 0); I've also tried SQL_CONCUR_ROWVER, and SQL_CONCUR_VALUES Here's a synopsis of the remaining code: SQLExecDirect (m_hStmt, (unsigned char *) m_SqlStmt, SQL_NTS); for (i=0;i<NumberofColumns;++i) SQLBindCol (m_hStmt, (UWORD) i, m_Cols[i-1].cType, m_Cols[i-1].pValues, m_Cols[i-1].Width, m_Cols[i-1].pOutLens); //----------------------------------------------------------------------- void CDbListCtrl::OnOdCacheHint (NMHDR* pNMHDR, LRESULT* pResult) { SQLFetchScroll (m_hStmt, SQL_FETCH_*, 0); FIRST, LAST or ABSOLUTE depending } //----------------------------------------------------------------------- void CDbListCtrl::OnGetdispinfo (NMHDR* pNMHDR, LRESULT* pResult) { PrintItemToListBox (pItem, Row, Col, &(m_Cols[Col].pValues[Row * (m_Cols[Col].Width)])); } I am not using Positioned Updates or Update Where Current Of .. Should I be? I am using a completely separate statement to do the update. Is what I am trying to do even possible? SQL Server 2000 SP 3a ODBC driver for SQL Server v 2000.85.1025.0 (11/18/2003) Any help or suggestions on troubleshooting the problem would be appreciated. Thanks |