|
|
 | | From: | Eric | | Subject: | RE: Need help with wxODBC | | Date: | Wed, 19 Jan 2005 21:21:32 +0000 (UTC) |
|
|
 | That's exactly what I was looking for! I was lost with the samples/db stuff because it really didn't do what I needed.
Thanks alot! Eric
-----Original Message----- From: "Tasker,George" Sent: Jan 19, 2005 2:01 PM To: wx-users@lists.wxwidgets.org Subject: RE: Need help with wxODBC
Demos\DbBrowse does something similar, but it is quite huge, and filled with UI code. Maybe this will help if you look at how it works.
g
> -----Original Message----- > From: Eric [mailto:wescotte@earthlink.net] > Sent: Wednesday, January 19, 2005 2:34 PM > To: wx-users@lists.wxwidgets.org > Subject: RE: Need help with wxODBC > > Yes, I read the wxODBC overview but I'm still abit confused. > Basically what I'd like to do is this. > wxDb *MyDB; > > OPEN MY CONNECTION (I've been able to do this) wxString > Query("SELECT * FROM BLAH WHERE BLAH BLAH"); > > MyDB->ExecSql(Query); > > if (MyDB->GetNext()) { // We have some results > MyDB->GetData(COL_NUM,DATA_TYPE , BUFFER,READ_SIZE , > &ACTAUL_AMOUNT_READ); } > > What I don't quite understand is how to correctly determine > the COL_NUM, the SQL_C_CHAR type as READ_SIZE. I can perform > a query using another app and find this information out and > simply fill it in but what I'd like to do is have my app do > it for me. I want to learn how to retrieve the data from a > column I know the column name of. > > Something along the lines of > > COL_NUM=FindResultColumn("TABLE COLUMN NAME"); SWORD > DATA_TYPE = MyDB->Results->GetDataTypeForColumn(COL_NUM); > SDWORD READ_SIZE = MyDB->Results->GetColumnSize(COL_NUM); > > Create my buffer based on the READ_SIZE and perform a > MyDB->GetData().... > > -----Original Message----- > From: "Tasker,George" > Sent: Jan 19, 2005 9:00 AM > To: wx-users@lists.wxwidgets.org > Subject: RE: Need help with wxODBC > > Have you looked at the wxODBC overview in the manual? It's a > very simple example of how to do it. All the GUI stuff is > stripped out, it's the simplest example there is. > > Unfortunately directly using wxString types is not currently possible. > Columns are "bound" to memory locations for use with ODBC > APIs, which does not play friendly with wxString. I have > some ideas on hiding that under the hood, but for now, you > should use wxChar arrays or string values. > > Also remember that sending your own SQL statement to the > database is a dangerous thing if you are going to be allowing > your program to use any supported ODBC datasource. The SQL > language may have a "standard", but you'd be surprised at the > various little nuances each DB manufacturer has (especially > when it comes to locking records). > > g > > > > -----Original Message----- > > From: Eric [mailto:wescotte@earthlink.net] > > Sent: Wednesday, January 19, 2005 1:21 AM > > To: wx-users@lists.wxwidgets.org > > Subject: Need help with wxODBC > > > > I'm abit confused on how to perform basic SQL statements > with wxODBC. > > I've been able to connect to my database and execute SQL statements > > but I'm having issues retrieving the results. > > Is there a simple way toss the result into a wxString per column? I > > guess what I'm asking is there a way I can execute and view > results as > > easy as with PHP > > > > $results=odbc_exec($connection, $query); while > > (odbc_next_result($results)) { > > $data=odbc_result($results, "COL_ID"); > > // DO WHAT I WANT WITH MY RESULTS HERE... > > } > > > > > > From what I can gather, after executing my SQL statement I > have know > > how many columns are in my results.. and then I have a void* that I > > process based on a data type flag. It just seems like there > should be > > an easier way to process than having to do all the work myself. > > > > Thanks > > > > Eric > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: wx-users-unsubscribe@lists.wxwidgets.org > > For additional commands, e-mail: wx-users-help@lists.wxwidgets.org > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: wx-users-unsubscribe@lists.wxwidgets.org > For additional commands, e-mail: wx-users-help@lists.wxwidgets.org > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: wx-users-unsubscribe@lists.wxwidgets.org > For additional commands, e-mail: wx-users-help@lists.wxwidgets.org >
--------------------------------------------------------------------- To unsubscribe, e-mail: wx-users-unsubscribe@lists.wxwidgets.org For additional commands, e-mail: wx-users-help@lists.wxwidgets.org
--------------------------------------------------------------------- To unsubscribe, e-mail: wx-users-unsubscribe@lists.wxwidgets.org For additional commands, e-mail: wx-users-help@lists.wxwidgets.org
|
|
|