• Welcome, Guest. Please login.
 
July 14, 2020, 06:55:26 am

News:

Welcome to the SQLitening support forums!


Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Fredrick Ughimi

616
Hello Fred,

I thought I tried that. I must have missed out something.

Thank you Fred.

Kind regards,
617
Hello,

I am re-writing my payroll program using SQLitening. To say the least I have been quite impressed with SQLitening. I have been able to do the things I used to do with Cheetah more efficiently and much more.

I am having problems breaking this line of SQLitening code:


slExe "Create Table If Not Exists tblPersonnel(PIN Integer Primary Key, Surname, Othernames, Sex, BirthDate, Age, FirstAppDate, ConfirmDate, RetireDate, Rank, CONTISS, HighQual, DeptSch, [Union], GLS, [Address], LGA, [State], MStatus, Shift, KinName, KinPhoneNo, KinEmail, KinAddress, KinRelate, PixPath, Remark )"


I get Source line too long - Error 407. Is there a special way to do it  'cos I tried the line continuation character without success.

Best regards,
618
Hello Fred,


slExe "Begin;" & slBuildInsertOrUpdate("tblName", "QtyOnHand + " & varValueToAdd & $VT, "QtyOnHand", "RowID=" & varRowID) & ";End"


Thanks for this code snippet. Saved me some stress. Rolf has been helping me to make sure my update routine works, then I saw the above code. This wasn't updating my records:


slExe slBuildInsertOrUpdate("tblCreateUsers", sUsername & $Nul & sPassword & $Nul & sStatus, "Username, Password, Status", [b]"Username='"+sUsername+"[/b]'")


Wonder why? So Rolf suggested I retrieve and save the ROWID in my search routine and use the stored ROWID in my update routine. All these I did and then came up with the following update routine that also wasn't working:


Local sRecordNo As String
Local lRecordNo As Long
sRecordNo = VD_GetText (nCbHndl, %ID_FRMCREATEUSERS_TXTRECORDNO)
lRecordNo = Val(sRecordNo)
slExe slBuildInsertOrUpdate("tblCreateUsers", sRecordNo & $Nul & sUsername & $Nul & sPassword & $Nul & sStatus, "rowid, Username, Password, Status", [b]"rowid=lRecordNo"[/b])


Wonder why this wasn't working also.

Your code above gave me an insight of what to do. I came up with this working code:


slExe slBuildInsertOrUpdate("tblCreateUsers", sUsername & $Nul & sPassword & $Nul & sStatus, "Username, Password, Status", [b]"rowid=" & sRecordNo[/b])


I noticed that using parameterised query in SQLitening is quite easy with no ambiguity.

I am beginning to love SQLitening as I love Cheetah:)

Best regards,


619
Fred,

Is it slBuildInsertOrUpdate or slBuildInsertOrDelete?

May be a new function?
620
Hello,

Thank you Rolf and David.

>>Column names are optional for Insert but required for Update

This makes all the difference when I am updating all the fields. I need to read the documentation more. :)

>>See extra comma!!! Very important!

Noted. This would work if I am updating just a field.

Best regards,


621
Rolf,

I see in your example you are using the rowid.
You know in the real world you might, after a search operation want to use the value of a textbox to modify the record Like:



sUsername = vd_gettext(ncbhndl, TextBoxID)
slExe slBuildInsertOrUpdate("tblCreateUsers", sUsername & $Nul & sPassword & $Nul & sStatus, "Username = '" + sUsername + " ' ")



The syntax for using the rowid would be different.

Kind regards,

622
Hello Rolf,

That was fast.

Umm... what is really wrong with my codes?

Thank you.
623
Hello,

Been playing around SQLitening.

I want to update (Modify) a record based on the value of a textbox. In this case sUsername.

What is the correct syntax for updating a records using slBuildInsertOrUpdate and Update. I used the following:


slExe slBuildInsertOrUpdate("tblCreateUsers", sUsername & $Nul & sPassword & $Nul & sStatus, "Username = '" + sUsername + " ' ")


I got syntax error.in "="


slExe "Update tblCreateUsers Set Username = sUsername, Password = sPassword, Status = sStatus Where Username='" + sUsername + "'"


I got column not found in table error.

I guess I am missing something?  ???
624
Thanks guys for your response. :)

Still trying out some stuff with SQLitening so far so good.

625
Hello Fred,

>>See the following routine in ExampleC.Bas:

Yeah, I have seen that. That means one is improvising here. Data Navigation is not built into neither SQLitening or SQLite. With this method one could run out of memory if the resultset is very large. Anyway it's not very wise to navigate very large records one record at a time. ;)

Thank you for your response and the great work on SQLitening.

Best regards,





626
Hello Fred,

>>Take a look at the slSelAry routine.

Ok.

>>For PowerBASIC users this will put a record set into an array.

I use Powerbasic For Windows 9. Ok after putting the records in an array. You navigate using what commands? I think sample codes would in place here.

Thank you for your response.

Regards,
627
Hello,

Thank you Paul and Fred for your response.

>>Huh? SQLite and SQliteing both allow you to navigate through the resulting recordset. Maybe you mean something different by the term "data navigation".

What I meant was being able to navigate records like Cheetah does. Having something like MoveFirst, MovePrevious, MoveNext and MoveLast.

All in all I think I would use SQLitening for my next project.

Kind regards,
628
Hello All,

I wonder if SQLitening can handle parameterised Query. Something like this:


local sFrom as string
local sTo as string

CONTROL GET TEXT hDlg, FromDateid& TO sFrom
CONTROL GET TEXT hDlg, ToDateid& TO sTo

SELECT * FROM tblStoreReceives WHERE [InvoiceDate] BETWEEN sFrom AND sTo


Since SQLite don't support data navigation, would it be impractical to implement it in SQLitening? Just wondering. 'Cos Clients like to navigating their data.

Thanks guys for the great work with SQLitening.

Kind regards,

629
Hello Paul,

You are right once again. Its now working. You have Eagle eyes.  ;)

Thank you so much.

Best regards,
630
Hello Paul,

>>You are only setting the database name variable when the database does not exist ot exist...

Oops! You are right. Should have done this (sDatabase = "EmlenPharmacyProDB.db3") before testing. The DB actually exist.

>>You should create your database using SQLite Expert and then use code like the following to alert the user in situations where the database does not exist or is not installed with your application.

That is what I did. I created my DB and table using SQLite Expert. Made the correcttion, but the error 1 is still there.

Best regards,