ActiveRecord and ARGen

We updated ActiveRecord and ARGen today. Official announcement here: http://www.bkeeneybriefs.com/2013/11/activerecord-and-argen-updates/

ActiveRecord is a set of classes that helps you abstract your database into Xojo classes. This gives you Table/Field autocomplete in the code editor and the compiler will flag datatype mismatches. We’ve used it many of our consulting projects and it saves us a ton of time. The update today lets it now work with CubeSQL server, PostgreSQL, MySQL, MS SQL Server, and SQLite (both the Real Studio and Xojo versions). Oracle was added but it’s totally unsupported by us.

ARGen (now at version 1.5) is a $19.95 utility that quickly creates the necessary data classes needed by ActiveRecord. It scans your db, lets you select the tables you want and it generates and xml project file with the project stuff in it. It now supports the same databases as ActiveRecord. It also adds the ability to add suffixes to your field names.

If you find database coding to be tedious, time consuming, and repetitive you might like ActiveRecord.

We released updates to both ActiveRecord and ARGen today. Mostly maintenance updates but some important ones if you are working with large databases. All of the record ID’s are now 64bit integer’s. The other big change was the addition of time field handling.

This update is free for ARGen users. They can update through the app or download from website.

ActiveRecord is free and available at its homepage.

It was pointed out that my links are not valid.

http://www.bkeeney.com/rbinto/activerecord/ ActiveRecord landing page.
http://www.bkeeney.com/allproducts/argen/ ARGen landing page.

We released ARGen 1.6.3 today http://www.bkeeneybriefs.com/2014/09/argen-1-6-3/.

This is a maintenance release and is free for all registered users. Non-registered users have limited functionality.

Change List:
• Fixes a CubeSQL bug
• Adds an additional prefix/suffix check for fields in the data classes.
• Fixes Windows updater bug

Windows users should update manually by downloading from the BKeeney website.

We updated ARGen to 1.6.4 today.

This is a maintenance update and is free for all registered users.

Change List:
• Field matching now works again when NO prefix or suffix is chosen in preferences.

http://www.bkeeney.com/allproducts/argen/

Hi,

I had a license copy of ARGEN and I am now trying to figure out on how the xojo works from it.

I just want to know if you have sample xojo that connect to Microsoft Sql and show record to list box?

Because most of examples here are using sql lite which is not my preference.

Please

Ronaldo asked for the example project that I used with the Xojo Webinar at https://www.youtube.com/watch?v=xIMsmoQ4y3Q

The file is at https://dl.dropboxusercontent.com/u/24111541/ActiveRecord%20Webinar%20Example%20Project.zip

[quote=210606:@ronaldo florendo]I just want to know if you have sample xojo that connect to Microsoft Sql and show record to list box?

Because most of examples here are using sql lite which is not my preference.[/quote]

The big difference is in the Data.OpenDB method. Instead of handing off a FolderItem to the SQLite database file, you’ll use the connection properties for MS SQL Server to create the db object, and then connect to it. You’ll also want to set BKS_ActiveRecordConfig.kIncludeMSSQLServer = True that code branch is used.

Just in case you didn’t know MS SQL Server only works on Windows.

Thanks for the reply. I made it to connect t MS SQL and list record in Listbox.

I followed the actual sample codes you provided.

However im stuck after click the SAVE button. The Save Method pops an error. I attached the screenshot for your reference so that you can help me.

Click Project and unselect Break on Exceptions. You can toggle it on or off wether you want the debugger to stop or continue on exceptions.

What I mean is, how to fix this error.

Anybody encountered same problem? Please help me to get out of this error. Im using Arcgen from Bkeeny

Im lost here.

Im using:
MS SQL 2008R2
Windows 8.1
Xojo 2.4

Amando, thanks for your instruction. I capture the actual error message.
Maybe somebody can help me. Here is the error:

Unhandled BKS_ActiveRecord.DatabaseException
Message: 102: Incorrect syntax near ‘BEGIN’.
BEGIN

Stack:
BKS_ActiveRecord.Base.Save%%o<BKS_ActiveRecord.Base>
dlgTaxMaster.dlgTaxMaster.Save%%o<dlgTaxMaster.dlgTaxMaster>
dlgTaxMaster.dlgTaxMaster.ButtonSave_Action%%o<dlgTaxMaster.dlgTaxMaster>o
Delegate.IM_Invoke%%o
AddHandler.Stub.28%%
WebButton._ExecuteEvent%b%osA1v
WebControl.!_ExecuteEvent%b%ssA1v
WebSession._HandleEvent%%oso<_HTTPServer.HTTPRequestContext>
WebSession._HandleRequest%i4%oso<_HTTPServer.HTTPRequestContext>
WebApplication._HandleHTTPRequest%%oo<_HTTPServer.HTTPRequestContext>
_HTTPServer.HTTPRequestThread.Event_Run%%o<_HTTPServer.HTTPRequestThread>

Hi Bob,

I need your help here. Please.

Im so sorry.

I cannot understand why my concern was not replied by anybody here.

By the way,
I tried to use POSTGres and I encountered error. I tried to use MS SQL error also.

I tried to use SQLITE and it work without any problem.

Anybody from this forum can give insight on what does this Argen can and cannot?

Well, some of us like have a life. Asking questions on the weekend is the worst time to do it. And, frankly, you’re coming across as ‘needy’ rather than doing the work/research yourself. This community is very helpful but you have to put some work in.

Okay, so ActiveRecord is OPEN SOURCE. You should be able to drill down and figure out what it happening. MS SQL Server is probably the least used section of code in AR (because MS SQL Server is not big in the Xojo community) so it doesn’t surprise me that there’s something not working right.

You said yourself that you are new to Xojo. Frankly, I wouldn’t use ActiveRecord just yet. You need to learn the basics of using databases with Xojo FIRST, before diving off into the weeds in a big framework like AR. Everything in AR is using standard Xojo libraries.

If you take the time to learn Xojo you’ll be able to a) use the debugger to help identify where the real issue is; b) possibly be able to fix the problem yourself or at least be more helpful in asking questions.

I have not replied to your many private emails. I will be looking at MS SQL Server AFTER I get all my regular work done. It might take a few days so please be patient. Learn more about Xojo database programming in the meantime.

You might want to look at alternatives to ActiveRecord if you can’t wait:

Easy Data: https://github.com/campsoftware/Xojo-EasyData
Storm: GitHub - paullefebvre/storm: ORM for SQLite and Xojo

You might find them more to your liking.

Hi Bob,

Thank you for your response.

Although im new to XOJO, I am able to adopt it immediately because its simplicity. I prioritized to buy AR I believed it will provides me great avenue to make things more simplified. Everything is done well.

Unfortunately, I got stuck with some error that I believe it belongs to someone (either database drivers or AR).

I tried using Postgress on same code, I failed.

I tried using MSSQL on same code, I failed

I tried using SQLite on same code, it works!

Now, im can ADD/EDIT/DELETE record using SQLite. But my target database system is atleast Postgress or MSsql. If you can provide me sample ARGEN for those database, it will be very much helpful!

Thanks Bob. I hope for your kindness.

Where is your code to Open your database?

[quote=210762:@ronaldo florendo]I tried using Postgress on same code, I failed.

I tried using MSSQL on same code, I failed

I tried using SQLite on same code, it works!

Now, im can ADD/EDIT/DELETE record using SQLite. But my target database system is atleast Postgress or MSsql. If you can provide me sample ARGEN for those database, it will be very much helpful![/quote]

¿No crees que te estás pasando al pedir un favor? Creo que @Bob Keeney ha sido muy explicito en su mensaje. Si no, usa Google Translate …

Una cosa es pedir ayuda, como todos lo hacemos y otra diferente es exigir. Bob se gana la vida como consultor…

Modus in rebus! (latin)

Well, after spending some time looking at it over the weekend, it looks like ActiveRecord won’t work with MS SQL Server at this point in time. Not because of anything in ActiveRecord but because of the Xojo MS SQL Server plugin.

It seems that it doesn’t work, at all, with PreparedStatements and ActiveRecord is using them for Insert, Update, and Delete. Documented in April 2015 in <https://xojo.com/issue/39027>.

A while ago I was struggling with MS SQL Server and stored procedures. Could not get it working with the Xojo-native SQL Server plugin and gave up for the moment.
Think @Jim Cramer was right with his FB: “Looks like the MSSQL database driver needs some attention.”
@Christian Schmitz does MBS provide a solution for it ?