Merci, Robert, pour le réponse.
Ça marche pas pour moi, je devine que je comprend pas bien!
J'ai essayé:
1. filtervalue1=hk_thisform.get_pyvisible("author_name_input").value()
2. db=hk_thisform.database()
3. de=db.new_table("author_table")
4. de.enable()
5. de.setmode_insertrow()
6. de.column_by_name("author_name").set_asstring(filtervalue1)
7. de.disable()
Mais j'ai l'erreur:
Line 6: 'None Type' object has no attribute 'set_asstring'.
Je devine que je comprend pas "de"!
Merci encore.
Rob
Robert Leleu wrote:
> français/esperanto/english
>
> le code suivant me permet d'ajouter des lignes nouvelles dans une table/
> la sekvonta kodo aldonas linioj en tablo/
> the following code effectively adds lines in a table
>
> /#ecrire les valeurs dans le fichier etiquettes/
> de.enable()
> de.setmode_insertrow()
> de.column_by_name("susg").set_asstring(susg)
> de.column_by_name("adr1g").set_asstring(adr1g)
> de.column_by_name("adr2g").set_asstring(adr2g)
> de.column_by_name("ccg").set_asstring(ccg)
> de.column_by_name("pag").set_asstring(pag)
> de.column_by_name("expg").set_asstring(expg)
> de.column_by_name("susd").set_asstring(susd)
> de.column_by_name("adr1d").set_asstring(adr1d)
> de.column_by_name("adr2d").set_asstring(adr2d)
> de.column_by_name("ccd").set_asstring(ccd)
> de.column_by_name("pad").set_asstring(pad)
> de.column_by_name("expd").set_asstring(expd)
> de.disable()
>
> demandez-moi plus de détails au besoin
> petu min pli etaĵojn se necesas
> ask me for further information if requested.
>
>
>
> Robert Wood skribis :
>> Hi all,
>>
>> I've learned lots now, including how to insert data into a table from a
>> form. I can now click a button on a form which writes data in some
>> linedits and comboboxes on a form into a table. However, unless I put a
>> second button on the form and assign insert row, the SQL just overwrites
>> the first row in the table I'm writing to.
>>
>> As a very simple example I have a form with a lineditfield whose
>> datasource is author_table (0) and column is author_name.I launch the
>> form, the lineeditfield has the first entry in author_table. I put the
>> following code into the button press for the inserting data into the table.
>>
>> db=hk_thisform.database()
>> sourcetable=db.new_table("author_table")
>> sourcetable.enable()
>> sourcetable.setmode_insertrow()
>>
>> (For sake of completeness, the following code does write data to the
>> table, but just overwrites the first line of the table.)
>>
>> filtervalue1=hk_thisform.get_pyvisible("author_name_input").value()
>> sqlstring = "INSERT INTO author_table (author_name) VALUES (" +
>> filtervalue1 + ");"
>> db=hk_thisform.database()
>> query=db.new_actionquery()
>> query.set_sql(sqlstring)
>> status=query.execute()
>>
>> I realise you can click the button at the bottom of the form to insert
>> new row, but this will be for non-computer people to use, so I need to
>> make it foolproof.
>>
>> Is there something I can put in before the script that inserts the data,
>> to insert a new row before writing the data into the table and
>> overwriting existing data?
>>
>> Many thanks,
>>
>> Rob
>>
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by: Microsoft
>> Defy all challenges. Microsoft(R) Visual Studio 2008.
>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>> _______________________________________________
>> Hk-classes-discuss mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/hk-classes-discuss
>>
>>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Hk-classes-discuss mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/hk-classes-discuss
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Hk-classes-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hk-classes-discuss