I believe your changes mean that your database handler pDoc->m_db wasn't open before the call to CMainView::myUpdateView() despite you thought so.
Pavel On Mon, Sep 28, 2009 at 9:12 AM, meng wei <willgu...@gmail.com> wrote: > THANKS VERY MUCH for so exhaustive reply! :-) > > I made my program run before I saw your reply, but I can't understand > how it works. > > The problem seems to be caused by the 1st parameter of sqlite3_exec. > sqlite3_exec(pDoc->m_db,pDoc->m_strSQL,sqlCallback_UpdateList , 0, > &(pDoc->m_pErrMsg)); > I changed "pDoc->m_db" and it works.Just like this: > > void CMainView::myUpdateView() > { > CSenateSystemDoc* pDoc = GetDocument(); > sqlite3_open("SenateSystem", &db); > > sqlite3_exec(db,pDoc->m_strSQL,sqlCallback_UpdateList , 0, > &(pDoc->m_pErrMsg)); > //formerly "sqlite3_exec(pDoc->*m_db*,"select * from table1", > sqlCallback_UpdateList, 0, &(pDoc->*m_pErrMsg*));" > sqlite3_close(db); > db = 0; > } > > I haven't made any changes to callback function ,but it works. Why? > > And why using a "sqlite3*" declared in another class(here pDoc->*m_db*) > will fail? > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users