What am I missing? If I create a new DataSnap project, put the WebModule into the autocreated forms, the project no longer compiles and the compiler complains about "Undeclared identifier 'WebModule1"'. But that is the correct name and I have done nothing else. Can someone try this and see if it works for you?

What am I missing? If I create a new DataSnap project, put the WebModule into the autocreated forms, the project no longer compiles and the compiler complains about "Undeclared identifier 'WebModule1"'. But that is the correct name and I have done nothing else. Can someone try this and see if it works for you?
I need to have the WebModule autocreate because I need to access the datasets on it from the main form. So far, I am coming up empty.
So, here is what I did:
1) Create new Datasnap Rest Application project
2) Stand-Alone VCL app
3) TComponent ancestor class.
4) Go to Project Options/Forms/move the WebModule to the autocreate section
Done- project will not compile.
What am I doing wrong?

Comments

  1. You will need to somehow losely connect web module on demand - such as Ondrej Kelle suggests.  I.e. when WebModule1 need a data set, it needs to call a function to get one.  The use of a data module springs to mind?

    ReplyDelete
  2. TWebModule descends from TDataModule.

    I think I am doing this wrong in the first place. What I need to do is be able to access a datasource from a ServerMethod and respond with JSON. I am able to see the main form from within the ServerMethods so I should be able to do what I need to do without touching the WebModule at all. I will test things out and if I am still stuck I'll post a new question at that point.

    Thanks everyone, your responses did allow me to think a little more on this and possibly solve my issue.

    ReplyDelete
  3. From within your server method, you can use Datasnap.DSHTTPWebBroker.GetDatasnapWebModule and cast it to your TWebModule1. This has nothing to do with the main form, though (hopefully).

    ReplyDelete

Post a Comment