<html><head></head><body><div class="ydpc0129f6dyahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:13px;"><div id="ydpc0129f6dyiv5136539715"><div class="ydpc0129f6dyiv5136539715ydp3183cbc2yahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:13px;"><div id="ydpc0129f6dyiv5136539715ydp3183cbc2yiv7294310629"><div class="ydpc0129f6dyiv5136539715ydp3183cbc2yiv7294310629ydp3c17bf19yahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:13px;"><div></div>
        <div>Hi Benoit</div><div><br></div><div>I must admit that is easier said than done. Nowhere have I found anything pertaining to using the find etc methods and as you can see my attempt at using it failed and it was this request that sparked all the replies, though not one really pertaining to my question. In C I used to do it like that using sqlite3_exec / sqlite3_prepare_v2 etc and I basically moved towards familiar grounds first due to lack of documentation or examples.</div><div><br></div><div>So, looking at my second example again, and going back to my question... what am I missing?</div><div><br></div><div>Probably, my question should be</div><div> When do you use db.Find() and under what circumstances would you use db.Edit() and how do they tie together. As Ced stated, a 'realworld example' would be a plus...</div><div><br></div><div>open database</div><div>create table</div><div>new record</div><div>update record</div><div>delete record</div><div>close db</div><div><br></div><div>Regards</div><div><br></div><div>David</div><div><br clear="none"></div>
        
        </div></div></div></div></div><div class="yiv5136539715yqt2126529779" id="yiv5136539715yqt44885"><div class="yiv5136539715yqt7413685930" id="yiv5136539715yqt98385"><div class="yiv5136539715yahoo_quoted" id="yiv5136539715yahoo_quoted_0224271255">
            <div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
                
                <div>
                    On Thursday, May 30, 2019, 4:12:07 PM GMT+2, Cedron Dawg <cedron@exede.net> wrote:
                </div>
                <div><br clear="none"></div>
                <div><br clear="none"></div>
                <div><div dir="ltr">Absolutely!  You should use the sugar syntax $Sql &= "blah blah blah" instead.<br clear="none"><br clear="none">Ahhh, just kidding.<br clear="none"><br clear="none">What I am really wondering is if there is an example project that has the right way to do it for the whole process.  Meaning some kind of form having a search list, a record selection, a record edit and update, a new record added with all the different data types included, some perhaps displayed with alternative available controls.<br clear="none"><br clear="none">Of course, it would also have the code backing it showing the proper use of Subst with Exec() and Find() examples.<br clear="none"><br clear="none">Are there any such officially (read Benoit) approved projects?<br clear="none"><br clear="none">Thanks,<br clear="none"><br clear="none">Ced<br clear="none"><br clear="none"><br clear="none"><br clear="none">----- Original Message -----<br clear="none">From: "Benoît Minisini" <<a rel="nofollow" shape="rect" ymailto="mailto:g4mba5@gmail.com" target="_blank" href="mailto:g4mba5@gmail.com">g4mba5@gmail.com</a>><br clear="none">To: "user" <<a rel="nofollow" shape="rect" ymailto="mailto:user@lists.gambas-basic.org" target="_blank" href="mailto:user@lists.gambas-basic.org">user@lists.gambas-basic.org</a>><br clear="none">Sent: Thursday, May 30, 2019 9:34:06 AM<br clear="none">Subject: Re: [Gambas-user] Using dates in Gambas<br clear="none"><br clear="none">Le 30/05/2019 à 10:54, David Silverwood via User a écrit :<br clear="none">> Hi. Me again<br clear="none">> <br clear="none">> So this is my code...<br clear="none">> <br clear="none">> /Public Sub btnUpdate_Click()/<br clear="none">> //<br clear="none">> /    $Sql = "UPDATE cashup SET ("/<br clear="none">> /    $Sql = $Sql & "date = '" & edtDate.Text & "', "/<br clear="none">> /    $Sql = $Sql & "ref = '" & edtTransNo.Text & "', "/<br clear="none">> /    $Sql = $Sql & "amount = " & ValueBox1.Text & ", "/<br clear="none">> /    $Sql = $Sql & "comment = '" & edtDescription.Text & "', "/<br clear="none">> /    $Sql = $Sql & "WHERE date = '" & edtDate.Text & "';"/<br clear="none">> //<br clear="none"><br clear="none">You MUST NOT make your SQL request like that.<br clear="none"><br clear="none">NEVER.<br clear="none"><br clear="none">███╗   ██╗███████╗██╗   ██╗███████╗██████╗     ██╗<br clear="none">████╗  ██║██╔════╝██║   ██║██╔════╝██╔══██╗    ██║<br clear="none">██╔██╗ ██║█████╗  ██║   ██║█████╗  ██████╔╝    ██║<br clear="none">██║╚██╗██║██╔══╝  ╚██╗ ██╔╝██╔══╝  ██╔══██╗    ╚═╝<br clear="none">██║ ╚████║███████╗ ╚████╔╝ ███████╗██║  ██║    ██╗<br clear="none">╚═╝  ╚═══╝╚══════╝  ╚═══╝  ╚══════╝╚═╝  ╚═╝    ╚═╝<br clear="none"><br clear="none">You must use the substitution feature of the Exec(), Find()... methods <br clear="none">of the Connection object, which takes care for you of quoting SQL values <br clear="none">accordingly to the underlying database to prevent SQL requests injections.<br clear="none"><br clear="none">And you must convert the text entered in the controls into the <br clear="none">corresponding datatypes (Date, Integer, Float, Boolean, String) before <br clear="none">passing them to the Exec(), Find()... methods.<br clear="none"><br clear="none">Regards,<br clear="none"><br clear="none">-- <br clear="none">Benoît Minisini<br clear="none"><br clear="none">----[ Gambas mailing-list is hosted by <a rel="nofollow" shape="rect" target="_blank" href="https://www.hostsharing.net ">https://www.hostsharing.net </a>]----<div class="yiv5136539715yqt7221045531" id="yiv5136539715yqtfd42761"><br clear="none"><br clear="none">----[ Gambas mailing-list is hosted by <a rel="nofollow" shape="rect" target="_blank" href="https://www.hostsharing.net ">https://www.hostsharing.net </a>]----<br clear="none"></div></div></div>
            </div>
        </div></div></div></body></html>