Question
· Mar 23

Another C# to Cache Database

Hello everyone,

I have a Cache class with just 2 fields

Class JASON.BikeDB Extends (%Persistent, %Populate)

Property Make As %String [ Required ]; /// Model of the Motorcycle
Property Model As %String [ Required ];

I also have another class with several ClassMethods, just showing you 1 here

Class JASON.DataBase Extends %Persistent
{ ClassMethod SaveNew(Make As %String, Model As %String)
{
Set obj=##class(JASON.BikeDB).%New()
Set obj.Make=Make
Set obj.Model=Model
Set sve=obj.%Save()
}

I have a simple C# windows app with 2 text boxes "MAKE" and "MODEL"

I'm trying to just save the values of the 2 text boxes into my Cache Class  JASON.BikeDB

I have tried following docs from Intersystems (but I think examples use very old version of Visual Studio)

I have tried following examples from google

but failing miserably :-(

The main problem was a "Security" error when trying to connect to Cache so I set up a new user with all privilages etc. still same

Does anyone have any examples or willing to write a simple C# windows app with 2 fields that connects to Cache class please?

Anything will do

Jason

PS I have tried so many combinations of code that its a mess so going to start over

AND

My classes are in a namespace "DEVELOP"

Product version: Caché 2018.1
$ZV: Cache for Windows (x86-64) 2018.1.2 (Build 309_5) Wed Jun 12 2019 20:14:50 EDT
Discussion (6)3
Log in or sign up to continue

First of all, there are no links to docs you've tried in your post. If you add them (or the code from them) it will be easier to understand what you've already tried.

In general, I believe the easiest way to insert data in your case will be to use SQL. You can either write something like 

insert into JASON.BikeDB (Make, Model) values (:make, :model)

and pass the values of parameters.

Or if you wish to use your class method, you will first need to add a modifier SqlProc to it:

ClassMethod SaveNew(Make As %String, Model As %String) [SqlProc]
{
    Set obj=##class(JASON.BikeDB).%New()
    Set obj.Make=Make
    Set obj.Model=Model
    Set sve=obj.%Save()
}

and then call this as a stored procedure:

begin
   JASON.DataBase.SaveNew(:make, :model);
end;

Links to docs I have viewed

https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY...
https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY...
https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY...

Even though I use Cache I still looked at IRIS doc

https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls...

This is the error I am getting

And this is the view details

This is the Visual Studio

And this is the Cache Version

Cache' Studio Client  2018.1.2 Build 309 Patch 5
Server Cache for Windows (x86-64) 2018.1.2 (Build 309_5)

Documentation for your product/version is here:
https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls

Note that Caché 2018.1 supports .NET up to 4.5, it seems you are using 4.8, I'm not sure it works with 4.8.

In Caché Management Portal, go to System Administration -> Security -> Users, in the _SYSTEM user row click the "Profile" link (last column), after the .NET error, what's the content of "Last Reason for Failing to Login"?

AH!

ERROR #5915: Unable to allocate a license

I wonder what is wrong, I have had Cache on my home PC for literally ages, well over a year, from memory I downloaded from Intersystems and had zero trouble until trying to do what im trying now, studio works great, reflections terminal works great, management portal works great I can code ObjectScript and cls no problem.