|
|
Home » U++ Library support » U++ SQL » sql + editstring
sql + editstring [message #32347] |
Tue, 10 May 2011 15:48 |
begnur
Messages: 6 Registered: May 2011 Location: Turkmenistan
|
Promising Member |
|
|
how to pass WString from EditString to Sql and from Sql To EditString
for example (below exmaples are only for demonstration I need how to do this. and again characters are non ascii
EditString editstr
String s = editstr->GetString()
// s contains "þþþýýçç" , database contains p,q,r where p,q,r as string
Sql sql
sql * Select(p).From(databse).Where(q = s)
// clearing s string
s.Clear();
while(sql.Fetch())
s.Append(sql[p]);
editstr->SetString(s);
|
|
|
|
Re: sql + editstring [message #33082 is a reply to message #32350] |
Wed, 06 July 2011 10:06 |
|
forlano
Messages: 1202 Registered: March 2006 Location: Italy
|
Senior Contributor |
|
|
Didier wrote on Tue, 10 May 2011 20:16 | Hi begnur,
you can use an 'SqlCtrls' object to achieve what you want.
You can do something like this:
SqlCtrls ctrls;
ctrls(MY_TABLE_Field1, editString1 )
(MY_TABLE_Field2, editString2)
(MY_TABLE_Field2, editString3);
void updateDbOnEditString()
{
Sql sql;
sql * ctrls.Update(MY_TABLE).Where(MY_TABLE_ID == index);
}
void Query()
{
ctrls.Load( MY_TABLE, MY_TABLE_ID == index);
}
This is quite handy to use
Another way is to use an SqlArray object and set EditStrings as the controls for the each string field
|
Hello,
this example is very nice. SqlCtrls seems to have many potentiality but it looks not documented in contrast to SqlArray.
I tried your example but with a droplist instead of editString2 and Insert procedure.
It seems that editString1 pass its value to the table but the droplist miss its task.
May I ask a similar test case with a droplist (containing pairs of key, value).
Thanks,
Luigi
|
|
|
Re: sql + editstring [message #33083 is a reply to message #32347] |
Wed, 06 July 2011 10:33 |
|
spotted an error in the code!
begnur wrote on Tue, 10 May 2011 17:48 | how to pass WString from EditString to Sql and from Sql To EditString
for example (below exmaples are only for demonstration I need how to do this. and again characters are non ascii
EditString editstr
String s = editstr->GetString()
// s contains "þþþýýçç" , database contains p,q,r where p,q,r as string
Sql sql
sql * Select(p).From(databse).Where(q = s)
// clearing s string
s.Clear();
while(sql.Fetch())
s.Append(sql[p]);
editstr->SetString(s);
|
In line
sql * Select(p).From(databse).Where(q = s)
Must be
sql * Select(p).From(databse).Where(q == s)
SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
|
|
|
|
Re: sql + editstring [message #34691 is a reply to message #33082] |
Tue, 06 December 2011 15:10 |
|
jibe
Messages: 294 Registered: February 2007 Location: France
|
Experienced Member |
|
|
Hi,
forlano wrote on Wed, 06 July 2011 10:06 | this example is very nice. SqlCtrls seems to have many potentiality but it looks not documented in contrast to SqlArray.
I tried your example but with a droplist instead of editString2 and Insert procedure.
It seems that editString1 pass its value to the table but the droplist miss its task.
May I ask a similar test case with a droplist (containing pairs of key, value).
|
No answer to this question... Why ? Isn't it possible to use DropList with SqlCtrls ?
Thanks to confirm that it's impossible, or to tell how to do that : I cannot have it working too, and don't understand why ?
I can have it working for most Edit controls (EditString, EditInt, EditDouble, EditDate, DocEdit...) but not with DropList
|
|
|
|
|
|
|
|
|
Goto Forum:
Current Time: Fri Sep 20 04:14:34 CEST 2024
Total time taken to generate the page: 0.02491 seconds
|
|
|