 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Raul Lorenzo Guest
|
Posted: Thu Feb 09, 2006 2:03 pm Post subject: AnsiString, Spaces and TQuery::SQL |
|
|
Hi,
I attached the code file to see better. See in borland.public.attachments
I have this code which works fine with BCB6, but with BDS2006 BDE tells
me that 1 parameter is expected. I ran the SQL Query directly to the
database and it works well, so....
I think that the error could be in the line between /********/ , exactly
in -> _concepto+\" \"+B.desc_ <-
I need to concatenate an space to show it in the query result, but why
now crashes?
Note: To execute in access I need to change \" \" for \' \' , instead
errors. |
|
| Back to top |
|
 |
Darko Miletic Guest
|
Posted: Thu Feb 09, 2006 3:03 pm Post subject: Re: AnsiString, Spaces and TQuery::SQL |
|
|
Raul Lorenzo wrote:
| Quote: | Hi,
I attached the code file to see better. See in borland.public.attachments
I have this code which works fine with BCB6, but with BDS2006 BDE tells
me that 1 parameter is expected. I ran the SQL Query directly to the
database and it works well, so....
I think that the error could be in the line between /********/ , exactly
in -> _concepto+\" \"+B.desc_ <-
I need to concatenate an space to show it in the query result, but why
now crashes?
Note: To execute in access I need to change \" \" for \' \' , instead
errors.
|
If that is the case then the problem is in VCL database component and
not in AnsiString. Therefore direct your question to either one of
borland.public.cppbuilder.database groups or to
borland.public.cppbuilder.vcl.components.using
Darko
BTW you should not append strings like that because it is not optimal.
This is better/faster way:
AnsiString SQL_Detail1("(select A.desc_concepto, A.importe");
SQL_Detail1+=" from ";
SQL_Detail1+=t_concepto;
SQL_Detail1+=" as A,";
SQL_Detail1+=t_alum_con_recmensual;
SQL_Detail1+=" where ";
SQL_Detail1+=t_alum_con_recmensual;
SQL_Detail1+=".id_alum=";
SQL_Detail1+=alumno;
SQL_Detail1+=" and ";
SQL_Detail1+=t_alum_con_recmensual;
SQL_Detail1+=".mes=";
SQL_Detail1+=Get_Alumno_Mes();
SQL_Detail1+=" and ";
SQL_Detail1+=t_alum_con_recmensual;
SQL_Detail1+=".id_concepto=A.id_concepto";
SQL_Detail1+=" and A.concepto_detalle is NULL)";
/**********************/
SQL_Detail1+=" union (select A.desc_concepto+\" \"+B.desc_concepto,
B.importe";
/**********************/
SQL_Detail1+=" from ";
SQL_Detail1+=t_concepto;
SQL_Detail1+=" as A,";
SQL_Detail1+=t_concepto;
SQL_Detail1+=" as B,";
SQL_Detail1+=t_alum_con_recmensual;
SQL_Detail1+=" where ";
SQL_Detail1+=t_alum_con_recmensual;
SQL_Detail1+=".id_alum=";
SQL_Detail1+=alumno;
SQL_Detail1+=" and ";
SQL_Detail1+=t_alum_con_recmensual;
SQL_Detail1+=".mes=";
SQL_Detail1+=Get_Alumno_Mes();
SQL_Detail1+=" and ";
SQL_Detail1+=t_alum_con_recmensual;
SQL_Detail1+=".id_concepto=B.id_concepto";
SQL_Detail1+=" and A.id_concepto=B.concepto_detalle)"; |
|
| Back to top |
|
 |
Raul Lorenzo Guest
|
Posted: Wed Feb 15, 2006 8:03 pm Post subject: Re: AnsiString, Spaces and TQuery::SQL |
|
|
Thanks, now I got to make query to database, I will try to optimize that
code like you told me.
Darko Miletic escribió:
| Quote: | Raul Lorenzo wrote:
Hi,
I attached the code file to see better. See in borland.public.attachments
I have this code which works fine with BCB6, but with BDS2006 BDE tells
me that 1 parameter is expected. I ran the SQL Query directly to the
database and it works well, so....
I think that the error could be in the line between /********/ , exactly
in -> _concepto+\" \"+B.desc_ <-
I need to concatenate an space to show it in the query result, but why
now crashes?
Note: To execute in access I need to change \" \" for \' \' , instead
errors.
If that is the case then the problem is in VCL database component and
not in AnsiString. Therefore direct your question to either one of
borland.public.cppbuilder.database groups or to
borland.public.cppbuilder.vcl.components.using
Darko
BTW you should not append strings like that because it is not optimal.
This is better/faster way:
AnsiString SQL_Detail1("(select A.desc_concepto, A.importe");
SQL_Detail1+=" from ";
SQL_Detail1+=t_concepto;
SQL_Detail1+=" as A,";
SQL_Detail1+=t_alum_con_recmensual;
SQL_Detail1+=" where ";
SQL_Detail1+=t_alum_con_recmensual;
SQL_Detail1+=".id_alum=";
SQL_Detail1+=alumno;
SQL_Detail1+=" and ";
SQL_Detail1+=t_alum_con_recmensual;
SQL_Detail1+=".mes=";
SQL_Detail1+=Get_Alumno_Mes();
SQL_Detail1+=" and ";
SQL_Detail1+=t_alum_con_recmensual;
SQL_Detail1+=".id_concepto=A.id_concepto";
SQL_Detail1+=" and A.concepto_detalle is NULL)";
/**********************/
SQL_Detail1+=" union (select A.desc_concepto+\" \"+B.desc_concepto,
B.importe";
/**********************/
SQL_Detail1+=" from ";
SQL_Detail1+=t_concepto;
SQL_Detail1+=" as A,";
SQL_Detail1+=t_concepto;
SQL_Detail1+=" as B,";
SQL_Detail1+=t_alum_con_recmensual;
SQL_Detail1+=" where ";
SQL_Detail1+=t_alum_con_recmensual;
SQL_Detail1+=".id_alum=";
SQL_Detail1+=alumno;
SQL_Detail1+=" and ";
SQL_Detail1+=t_alum_con_recmensual;
SQL_Detail1+=".mes=";
SQL_Detail1+=Get_Alumno_Mes();
SQL_Detail1+=" and ";
SQL_Detail1+=t_alum_con_recmensual;
SQL_Detail1+=".id_concepto=B.id_concepto";
SQL_Detail1+=" and A.id_concepto=B.concepto_detalle)"; |
|
|
| Back to top |
|
 |
Raul Lorenzo Guest
|
Posted: Wed Feb 15, 2006 8:03 pm Post subject: Re: AnsiString, Spaces and TQuery::SQL |
|
|
I solved the problem, I think something changed from previous versions
to BDS2006 in TQuery, so I changed _concepto+\" \"+B.desc_ to
_concepto+\' \'+B.desc_ and now works like before.
Raul Lorenzo escribió:
| Quote: | Hi,
I attached the code file to see better. See in borland.public.attachments
I have this code which works fine with BCB6, but with BDS2006 BDE tells
me that 1 parameter is expected. I ran the SQL Query directly to the
database and it works well, so....
I think that the error could be in the line between /********/ , exactly
in -> _concepto+\" \"+B.desc_ <-
I need to concatenate an space to show it in the query result, but why
now crashes?
Note: To execute in access I need to change \" \" for \' \' , instead
errors. |
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|