Another C# to Cache Database
Hello everyone,
I have a Cache class with just 2 fields
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
{ 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"
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;
Almost impossible to help without details on the .NET code you are using to connect and call Caché.
You are using an old version/product too, Caché 2018.1.
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!
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.
Just wanted to say thank you, I think I'll give C# to cache a miss and stick with C# to MySQL or even .csv files as I'm only doing this as hobby at home so not really needed, thanks anyway :-)