------=_NextPart_000_0038_01C56A17.539605A0
Content-Type: text/plain;
charset="US-ASCII"
Content-Transfer-Encoding: 7bit
Hello,
I'm using wxWidgets now a long time for designig my applications. This
weekend I tried first to use the Database classes, but I've got a
problem with them...
I've got an Microsoft Access Datenbase, with two tables:
Orte(ID, Staat, Name, and so on)
PLZOrte(ID, PLZ)
This tables are set into a relationship. The field ID ist the primary
key in Orte and set up the relation. Now I'd like to do a query to this
database in my program.
Therefore I used a wxTable pointer:
m_PLZOrte = new wxDbTable( m_DB, "PLZOrt", 3);
m_PLZOrte->SetColDefs(0, "ID", DB_DATA_TYPE_INTEGER, &m_PLZOrtSatz.ID,
SQL_C_NUMERIC, sizeof(m_PLZOrtSatz.ID), true, true);
m_PLZOrte->SetColDefs(1, "Name", DB_DATA_TYPE_VARCHAR,
&m_PLZOrtSatz.Ort, SQL_C_WXCHAR, sizeof(m_PLZOrtSatz.Ort), true, true);
m_PLZOrte->SetColDefs(2, "PLZ", DB_DATA_TYPE_VARCHAR, &m_PLZOrtSatz.PLZ,
SQL_C_WXCHAR, sizeof(m_PLZOrtSatz.PLZ), true, true);
I want to get back the fields ID, Name and PLZ from the query, like I
set with the SetColDefs() funktion.
Then I set the From and Where Clause to get a Join:
m_PLZOrte->SetWhereClause(wxT("Orte.ID = PLZOrt.ID"));
m_PLZOrte->SetFromClause(wxT("Orte"));
PLZOrt is the Basetable and PLZOrt the second table.
But when I execute this query with m_PLZOrte->Query() it doesn't work.
The function returns false every time.
The connection to the database can be set up correct, I think, because
this fuction return no error...
Can anyone tell me, what I'm doing wrong?
Thanks in advance
Daniel
------=_NextPart_000_0038_01C56A17.539605A0
Content-Type: text/html;
charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<TITLE>Nachricht</TITLE>
<META content=3D"MSHTML 6.00.2900.2627" name=3DGENERATOR></HEAD>
<BODY>
<DIV><SPAN class=3D578442219-05062005><FONT face=3DArial=20
size=3D2>Hello,</FONT></SPAN></DIV>
<DIV><SPAN class=3D578442219-05062005><FONT face=3DArial=20
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D578442219-05062005><FONT face=3DArial size=3D2>I'm =
using wxWidgets=20
now a long time for designig my applications. This weekend I tried first =
to use=20
the Database classes, but I've got a problem with =
them...</FONT></SPAN></DIV>
<DIV><SPAN class=3D578442219-05062005><FONT face=3DArial=20
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D578442219-05062005><FONT face=3DArial size=3D2>I've =
got an=20
Microsoft Access Datenbase, with two tables:</FONT></SPAN></DIV>
<DIV><SPAN class=3D578442219-05062005><FONT face=3DArial =
size=3D2>Orte(ID, Staat,=20
Name, and so on)</FONT></SPAN></DIV>
<DIV><SPAN class=3D578442219-05062005><FONT face=3DArial =
size=3D2>PLZOrte(ID,=20
PLZ)</FONT></SPAN></DIV>
<DIV><SPAN class=3D578442219-05062005><FONT face=3DArial=20
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D578442219-05062005><FONT face=3DArial size=3D2>This =
tables are set=20
into a relationship. The field ID ist the primary key in Orte and set up =
the=20
relation. Now I'd like to do a query to this database in my program.=20
</FONT></SPAN></DIV>
<DIV><SPAN class=3D578442219-05062005><FONT face=3DArial=20
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D578442219-05062005><FONT face=3DArial =
size=3D2>Therefore I used a=20
wxTable pointer:<BR></FONT></SPAN><SPAN class=3D578442219-05062005><FONT =
size=3D2><FONT face=3DArial>m_PLZOrte =3D </FONT></FONT><FONT =
face=3DArial=20
size=3D2>new</FONT><FONT size=3D2><FONT face=3DArial> wxDbTable( m_DB, =
"PLZOrt",=20
3);</FONT></FONT></SPAN></DIV>
<DIV><SPAN class=3D578442219-05062005></SPAN><SPAN =
class=3D578442219-05062005><FONT=20
size=3D2><FONT face=3DArial>m_PLZOrte->SetColDefs(0, "ID", =
DB_DATA_TYPE_INTEGER,=20
&m_PLZOrtSatz.ID, SQL_C_NUMERIC, </FONT></FONT><FONT =
face=3DArial><FONT=20
size=3D2>sizeof</FONT><FONT size=3D2>(m_PLZOrtSatz.ID), </FONT><FONT=20
size=3D2>true</FONT><FONT size=3D2>, </FONT><FONT =
size=3D2>true</FONT></FONT><FONT=20
size=3D2><FONT face=3DArial>);</FONT></FONT></SPAN></DIV>
<DIV><SPAN class=3D578442219-05062005><FONT size=3D2><FONT=20
face=3DArial>m_PLZOrte->SetColDefs(1, "Name", DB_DATA_TYPE_VARCHAR,=20
&m_PLZOrtSatz.Ort, SQL_C_WXCHAR, </FONT></FONT><FONT =
face=3DArial><FONT=20
size=3D2>sizeof</FONT><FONT size=3D2>(m_PLZOrtSatz.Ort), </FONT><FONT=20
size=3D2>true</FONT><FONT size=3D2>, </FONT><FONT =
size=3D2>true</FONT></FONT><FONT=20
size=3D2><FONT face=3DArial>);</FONT></FONT></SPAN></DIV>
<DIV><SPAN class=3D578442219-05062005><FONT size=3D2><FONT=20
face=3DArial>m_PLZOrte->SetColDefs(2, "PLZ", DB_DATA_TYPE_VARCHAR,=20
&m_PLZOrtSatz.PLZ, SQL_C_WXCHAR, </FONT></FONT><FONT =
face=3DArial><FONT=20
size=3D2>sizeof</FONT><FONT size=3D2>(m_PLZOrtSatz.PLZ), </FONT><FONT=20
size=3D2>true</FONT><FONT size=3D2>, </FONT><FONT =
size=3D2>true</FONT><FONT=20
size=3D2>);</FONT></FONT></SPAN></DIV>
<DIV><SPAN class=3D578442219-05062005><FONT face=3DArial =
size=3D2></FONT></SPAN><SPAN=20
class=3D578442219-05062005><FONT face=3DArial><FONT=20
size=3D2></FONT></FONT></SPAN> </DIV>
<DIV><SPAN class=3D578442219-05062005><FONT face=3DArial><FONT =
size=3D2>I want to get=20
back the fields ID, Name and PLZ from the query, like I set with the=20
SetColDefs() funktion.</FONT></FONT></SPAN></DIV>
<DIV><SPAN class=3D578442219-05062005><FONT face=3DArial><FONT=20
size=3D2></FONT></FONT></SPAN> </DIV>
<DIV><SPAN class=3D578442219-05062005><FONT face=3DArial><FONT =
size=3D2>Then I set the=20
>From and Where Clause to get a Join:</FONT></FONT></SPAN></DIV>
<DIV><SPAN class=3D578442219-05062005></SPAN><SPAN=20
class=3D578442219-05062005><FONT><FONT size=3D2><FONT size=3D2><FONT=20
face=3DArial>m_PLZOrte->SetWhereClause(wxT("Orte.ID =3D=20
PLZOrt.ID"));</FONT></FONT></FONT></FONT></SPAN></DIV>
<DIV><SPAN class=3D578442219-05062005><FONT><FONT size=3D2><FONT =
size=3D2><FONT=20
face=3DArial>m_PLZOrte->SetFromClause(wxT("Orte"));</FONT></FONT></FON=
T></FONT></SPAN></DIV>
<DIV><SPAN class=3D578442219-05062005><FONT><FONT size=3D2><FONT =
size=3D2><FONT=20
face=3DArial></FONT></FONT></FONT></FONT></SPAN> </DIV>
<DIV><SPAN class=3D578442219-05062005><FONT><FONT size=3D2><FONT =
size=3D2><FONT=20
face=3DArial>PLZOrt is the Basetable and PLZOrt the second=20
table.</FONT></FONT></FONT></FONT></SPAN></DIV>
<DIV><SPAN class=3D578442219-05062005><FONT><FONT size=3D2><FONT =
size=3D2><FONT=20
face=3DArial></FONT></FONT></FONT></FONT></SPAN> </DIV>
<DIV><SPAN class=3D578442219-05062005><FONT><FONT size=3D2><FONT =
size=3D2><FONT=20
face=3DArial>But when I execute this query with m_PLZOrte->Query() it =
doesn't=20
work. The function returns false every time.=20
</FONT></FONT></FONT></FONT></SPAN></DIV>
<DIV><SPAN class=3D578442219-05062005><FONT face=3DArial=20
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D578442219-05062005><FONT face=3DArial size=3D2>The =
connection to=20
the database can be set up correct, I think, because this fuction return =
no=20
error...</FONT></SPAN></DIV>
<DIV><SPAN class=3D578442219-05062005><FONT face=3DArial=20
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D578442219-05062005><FONT face=3DArial size=3D2>Can =
anyone tell me,=20
what I'm doing wrong?</FONT></SPAN></DIV>
<DIV><SPAN class=3D578442219-05062005><FONT face=3DArial=20
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D578442219-05062005><FONT face=3DArial size=3D2>Thanks =
in=20
advance</FONT></SPAN></DIV>
<DIV><SPAN class=3D578442219-05062005><FONT face=3DArial=20
size=3D2>Daniel</FONT></SPAN><SPAN =
class=3D578442219-05062005><FONT><FONT=20
size=3D2><FONT size=3D2></DIV></FONT></FONT></FONT></SPAN></BODY></HTML>
------=_NextPart_000_0038_01C56A17.539605A0--