[Gambas-user] Non terminated String

Dag Jarle Johansen dag.jarle.johansen at ...2312...
Wed Feb 3 21:40:46 CET 2010


hi,

yes, because this is generated, and the user logged in is stored in
CurUser, and the variable then will be used. if not in quotes, there
would be the CurUser at the generation time (that would then always be
me). the finnished sub looks like this:

01 Public Sub but_DATA_BUD_New_Click()
02    CurSub = "but_DATA_BUD_New"
03    mMSg.MSG(1, "Neuanlage BUD")
04    SQL = "Insert Into " & BUD_TBL & " Set "
05    SQL = SQL & "datum='" & mIF.Init_SetNowDate() & "', "
06    SQL = SQL & "kommentar='NEU', "
07    SQL = SQL & " user = '" & mOPT.CurUser & "',"
08    SQL = SQL & "created ='" & mIF.Init_SetNow() & "'"
09    M.$Con.Exec(SQL)
10    mMSg.MSG(1, "Datensatz angelegt")
11 End

to better understanding of that all: I am writing a generator, and have
a sort of IDE; all data constructing the form comes partly from some
text-files which I parse, and the most of the data are stored in MySQL.
Line 01-04 comes from the data_panel_definition-table (there can be more
on one form),
Line 05-06 comes from a table, im which I define how to handle certain
fields adding an record, and there is no (easy) way to do that in MySQL,
and the lines 07 to 11 are always the same. 


regards,
Dag



Am Mittwoch, den 03.02.2010, 22:18 +0200 schrieb Jussi Lahtinen:
> > gambas 3 (or 2.99), revision i can't see :-(
> 
>  svn info
> 
> 
> > S = SF & "SQL = SQL " & Chr(34) & " user = '" & Chr(34) & " & mOPT.CurUser & " & Chr(34) & "',"
> 
>  " & mOPT.CurUser & " is inside of quote marks??
> 
> 
> Jussi
> 
> 
> 
> > then write it with:
> > Print #hf2, S
> >
> > Meanwhile I have solved it in another manner; because the last two lines
> > of SQL adding a record are always the same (storing user and creation
> > time), I just wrote a little textfile which I read here instead of
> > putting together the strings with &, and that works fine.
> >
> > I still do not understand what is happening with the concatenation, but
> > hope I will not drop into that any more. I make an SVN-Update tonight
> > and hope for the best.
> >
> > thanks for your time and concern,
> > regards
> > Dag
> >
> >
> >
> > Am Mittwoch, den 03.02.2010, 21:30 +0200 schrieb Jussi Lahtinen:
> >> I don't understand your problem.
> >> What is your Gambas version and revision?
> >> What are data types of SQL, S and mOPT.CurUser (I assume string)?
> >> And what is the exact line of code that generates described error message?
> >> With Gambas3 rev 2660 (@Ubuntu 9.10 64bit) I couldn't reproduce your problem.
> >>
> >> Jussi
> >>
> >>
> >> On Wed, Feb 3, 2010 at 20:56, Dag Jarle Johansen
> >> <dag.jarle.johansen at ...2312...> wrote:
> >> > Hi all,
> >> >
> >> > I can't figure out what I have wrong here. I am generating subs and
> >> > functions, and use a lot of string-handling. In just one line I become
> >> > the error: Non terminated String, looks like this:
> >> >
> >> > (1)
> >> > SQL = SQL & "user ='" & mOPT.CurUser & "',"
> >> >
> >> > the source generating is:
> >> > (2)
> >> > S = SF & "SQL = SQL " & Chr(34) & " user = '" & Chr(34) & " &
> >> > mOPT.CurUser & " & Chr(34) & "',"
> >> >
> >> > SF is just 4 Spaces.
> >> >
> >> > if I  (in 1) delete the space after "user='"_, here marked with an _, it
> >> > works. I have many lines generated, everywhere else it works.
> >> >
> >> > to make it eaysier to see:
> >> >
> >> > SQL = SQL & "user ='"_& mOPT.CurUser & "',"
> >> > the problem is here  ^
> >> >
> >> >
> >> > does anyone have an idea?
> >> >
> >> > thanks and regards,
> >> > Dag
> >> >
> >> >
> >> > ------------------------------------------------------------------------------
> >> > The Planet: dedicated and managed hosting, cloud storage, colocation
> >> > Stay online with enterprise data centers and the best network in the business
> >> > Choose flexible plans and management services without long-term contracts
> >> > Personal 24x7 support from experience hosting pros just a phone call away.
> >> > http://p.sf.net/sfu/theplanet-com
> >> > _______________________________________________
> >> > Gambas-user mailing list
> >> > Gambas-user at lists.sourceforge.net
> >> > https://lists.sourceforge.net/lists/listinfo/gambas-user
> >> >
> >>
> >> ------------------------------------------------------------------------------
> >> The Planet: dedicated and managed hosting, cloud storage, colocation
> >> Stay online with enterprise data centers and the best network in the business
> >> Choose flexible plans and management services without long-term contracts
> >> Personal 24x7 support from experience hosting pros just a phone call away.
> >> http://p.sf.net/sfu/theplanet-com
> >> _______________________________________________
> >> Gambas-user mailing list
> >> Gambas-user at lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/gambas-user
> >
> >
> >
> > ------------------------------------------------------------------------------
> > The Planet: dedicated and managed hosting, cloud storage, colocation
> > Stay online with enterprise data centers and the best network in the business
> > Choose flexible plans and management services without long-term contracts
> > Personal 24x7 support from experience hosting pros just a phone call away.
> > http://p.sf.net/sfu/theplanet-com
> > _______________________________________________
> > Gambas-user mailing list
> > Gambas-user at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
> >
> 
> ------------------------------------------------------------------------------
> The Planet: dedicated and managed hosting, cloud storage, colocation
> Stay online with enterprise data centers and the best network in the business
> Choose flexible plans and management services without long-term contracts
> Personal 24x7 support from experience hosting pros just a phone call away.
> http://p.sf.net/sfu/theplanet-com
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user






More information about the User mailing list