Where can I manage Server Objects? - asp-classic

How do I link an odbc object to a stored procedure I have written. Please see example below:
The following code executes a stored procedure called DEPT_Add, yet the name of the object function is AddDepartment.
Set oDept = Server.CreateObject("JTQTMS.JTDept")
bReturn = oDept.AddDepartment(CStr(sDeptName))
My question is if I add a new stored procedure called PROPERTY_Add for example, how would I go in and add an object function called AddProperty.
The below code does not seem to be working because I cannot find out where to create and link the AddProperty method to my stored proc PROPERTY_Add.
Set oProp = Server.CreateObject("JTQTMS.JTProperty")
bReturn = oProp.AddProperty(CStr(sDeptName), CStr(sDeptDescription))

This looks to me like JTQTMS.JTDept is a class of a COM component.
The class being JTDept, and the COM component being JTQTMS.
Look in Component Services (if i've remembered correctly), and see if you can find any references to it there.
I believe what is happening is the AddDepartment method of the COM component is calling the Dept_Add stored procedure internally.
To do the same with Property__Add, you'd need to add the AddProperty method to the COM component, which in turn calls the Property_Add stored procedure.

Related

How to call non-crud Stored Procedure from Entity Framework Code First

I have a simple stored procedure that takes no parameters and returns zero for success.
How do I wire that up using Code First so that I can call it from the Context?
When using an edmx (Database First) you can use the wizard to import a function and then call it on the Context:
Context.MyStoredProcedure();
Is there a way to do this with Code First?
I have found many examples but they are all CRUD type of stored procedures.
Greg
While I thought that there would be a specific mapping for a stored procedure on the context, the following is the only way I could find for Code First Development:
Context.Database.ExecuteSqlCommand("EXEC ClearLog");

org.springframework.dao.InvalidDataAccessApiUsageException: Configuration can't be altered once the class has been compiled or used

Iam inserting some data into DB with simpleJdbcInsert in spring , it works fine for first step (i mean for first insertion ) , when i try yo save the data for second time iam getting exception as :org.springframework.dao.InvalidDataAccessApiUsageException: Configuration can't be altered once the class has been compiled or used."
Can any one help me out in this.
This exception usually happens when you try to config(again) a compiled simpleJdbcInsert.
compiled means you have instantiated a simpleJdbcInsert instance and set up data source and table name already.
Once an simpleJdbcInsert instance is compiled, you should not re-config it again; for instance, set another table name. Create a new simpleJdbcInsert instace if you need to do so.
To get a comprehensive understanding about how simpleJdbcInsert works, take a look into source code of simpleJdbcInsert and AbstractJdbcInsert. especially the method compile() in AbstractJdbcInsert.java

Writing changes from editable datagrid back to local data store - Adobe Air/Flex

I am using Adobe Air to get data from SalesForce, and present it in a datagrid.
I am using a query to get the data, and then put it into an arraycollection that is bound to the datagrid, this works correctly and the data is displayed.
I have made the datagrid editable, and I am able to change the values in the datagrid, but I cannot find how to save the changes to the local database.
I am using the following code:-
protected function VisitReportGrid_changeHandler(event:ListEvent):void{
app.wrapper.save(VisitReportGridProvider)
}
But this has the following error when I try and compile it:-
1067: Implicit coercion of a value of type mx.collections:ArrayCollection to an unrelated type mx.data:IManaged.
Obviously I am doing this wrong, but I cannot find the correct syntax.
Thanks in advance for your help
Roy
This code is not enough to understand where actually is the problem
Need to know what is VisitReportGridProvider, what is wrapper.save() method.
**after comment:
F3DesktopWrapper.save():
public function save(item:IManaged):void
Saves the specified Managed object to the local database. You must make an explicit call to syncWithServer() to update the data on the salesforce server. However, do not call syncWithServer() too often (batch your save calls) as this may use up your alloted API usage. If the item is in conflict, the conflict will be resolved.
Parameters:
item:IManaged — The managed object to create or update.
you're passing parameter with type ArrayCollection which doesn't implement IManaged interface.
You need to pass the item in the ArrayCollection that was changed to the save function. Like:
acc.fieldCollection.updateObject(new AsyncResponder(function(o:Object, t:Object):void {
app.wrapper.save(o as Account);
}, function(e:Object):void {
}));

Instantiate Local Variable By Value?

I sort of understand why this is happening, but not entirely. I have a base class with a Shared (Static) variable, declared like so:
Public Shared myVar As New MyObject(arg1, arg2)
In a method of a derived class, I set a local variable like so:
Dim myLocalVar As MyObject = myVar
Now when I do something like myLocalVar.Property1 += value, the value in Property1 persists to the next call of that method! I suppose I get why it would be happening; myVar is being set by reference instead of by value, but I've never encountered anything like this before. Is there any way (other than my workaround which is to just create a new object using the property values of myVar) to create myLocalVar by value?
When you create myLocalVar you are creating a new reference to the same shared object. If you truly want a local copy of the shared instance you will need to create a true copy.
This is done by either cloning the instance or with a copy constructor on the type that allows you to create a copy of the instance. This is not as simple as it sounds, however, due to the differences between deep and shallow copying and a cloned or copied instance could create similar problems for you if the property you are accessing is simply a shallow-copied reference to the same instance that the property on the original instance is referencing.
The best thing I to do in this case is to create a local copy of only the parts of the shared instance that you need, rather than copying the entire object graph. This means create a local copy of whatever type Property1 is and using that.

pass parameters to HTTPService and use them inside the URL

Flex3 + Cairngorm. I have my service in Servicis.mxml:
<mx:HTTPService id="docIndex" url="{URL_PREFIX}/jobs/{???}/docs" resultFormat="e4x"/>
And I call it from my generic restful delegate like this:
public function index(params:Object):void {
var call:AsyncToken = services.getHTTPService(resourceName+"Index").send(params);
call.addResponder(responder);
}
I want to know how I can use the params Object I pass inside the url definition (the ??? above). And please tell me how you would go about searching an answer to this in the documentation, I'd like to be a little more independet on these problems...
EDIT: I'll explain myself if you didn't understand my problem:
I have a restful api written in rails to which I'm connecting. Doc is a child resource of Job. If I want to get all docs I have to supply a job_id too. Therefore in the service the url must be changed for each .send() call, with the proper job_id (the ??? part above). I'd like to call it like myDelegate.index({job_id:34}) and insert that job_id field in the Service URL.
Write a class that extends HTTPService and allows you to set parameters into the url. Then, in your index function you can fetch it with services.getHTTPService, and call a function you create that sets the url values for you.
In your service locator create an instance of your class rather than a flat HTTPService.

Resources