R: Question about wxDbTable.SetColDefs()

Baldassarre Cesarano baldassarre.cesarano at eunics.it
Tue Jun 5 10:02:28 PDT 2007


Hi,
For read/write a blob try this:

....
Long	m_Data[100];
....
m_tbPerson->SetColDefs(16, wxT("data"), DB_DATA_TYPE_BLOB, m_Data,
SQL_C_BINARY, sizeof(m_Data), false, true);
..................


Please note also: the 7th parameter (false) is for key fields
		the 8th par. (true) is for an updateable field (writing)!!!!

Ciao
	Baldo


-----Messaggio originale-----
Da: Ruizhi Ye [mailto:yeruizhi at gmail.com] 
Inviato: martedì 5 giugno 2007 18.18
A: wx-users at lists.wxwidgets.org
Oggetto: Question about wxDbTable.SetColDefs()

Hi, experts.

I am using wxDb and wxDbTable to write a DB application.

But I feel discommodious when I use wxDbTable.SetColDefs() to get data from
table, for example:

In the table, I write a long[100] into a varbinary column named "data".
Now I want to read these long datas into a long array ( long m_Data[100] ).
----------------------------------------------------
m_tbPerson->SetColDefs(16, wxT("data"), DB_DATA_TYPE_BLOB, m_Data,
SQL_C_WXCHAR, 100*sizeof(long));

this method will read each byte and cast it to char, 0 -> '0'.
----------------------------------------------------
m_tbPerson->SetColDefs(16, wxT("data"), DB_DATA_TYPE_BLOB, m_Data,
SQL_C_ULONG, 100*sizeof(long)); While using this method, the
m_tbPerson->Open() return false.
----------------------------------------------------
Could any expert give me some suggestion on SetColDefs?
How could I "copy" this buffer of long data from column in DB, to member
array?

Thanks.

---------------------------------------------------------------------
To unsubscribe, e-mail: wx-users-unsubscribe at lists.wxwidgets.org
For additional commands, e-mail: wx-users-help at lists.wxwidgets.org







More information about the wx-users mailing list