I'm creating something similar to dictionary and have a listbox with the words and an edit for the explanations. My listbox gets the contents of the words column in the database but when clicking on a word in the listbox it doesn't show the explanation in the edit. I have the following code for this:

invoke SendMessage,hList,LB_GETCURSEL,0,0
mov selection,eax
invoke SendMessage,hList,LB_GETTEXT,selection,addr selectiontext
invoke SQLAllocHandle,SQL_HANDLE_STMT,hConn,addr hStmt
invoke SQLPrepare,hStmt,addr SQLReadWords,sizeof SQLReadWords
invoke SQLBindParameter,hStmt,1,SQL_PARAM_INPUT,SQL_C_CHAR,SQL_CHAR,50,0,addr buffer,sizeof buffer,addr ParameterLen
invoke lstrcpy,addr buffer,addr selectiontext
mov ParameterLen,sizeof selectiontext
invoke SQLExecute,hStmt
invoke SQLBindCol,hStmt,1,SQL_C_CHAR,addr buffer,sizeof buffer,addr DataLength
invoke SQLFetch,hStmt
invoke SendMessage,hEdit,WM_SETTEXT,0,addr buffer



So, any help appreciated!



/siddhartha
Posted on 2004-09-10 05:51:42 by siddhartha
can you post the source? it would be alot easier to figure out. anyways it looks like you binded only the first column of the table. if your information is in the second column you will need to bind that column too.
Posted on 2004-09-10 10:22:00 by smurf
Indeed I found the problem - it was that I used unicode strings in the .mdb. So my listbox got them and displayed them right but the problem maybe is in SQLBindParameter, because the parameter is the unicode string from the listbox. So any ideas about this?



/siddhartha
Posted on 2004-09-11 03:07:14 by siddhartha