Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 3635 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies
Posted

Hi, I have an Execute SQL Insert command that needs to run when a user clicks a button on our Custom Web Solution (PHP).  The command should write data from my file to an outside user's MS SQL Server. 

 

The ODBC Connection to the outside MS SQL Server is set up on our FM 13 Server. 

 

The SQL Insert command works when ran manually on the client on the server.  Also runs as a scheduled script.  But will not work when called from the custom web solution. 

 

Code in the PHP page: 

$assetID = $_POST['assetID'];

$newPerformScript =@ $fm->newPerformScriptCommand('Vision_Export', 'web_Push_Data_to_VISION', $assetID );

$result =@ $newPerformScript->execute();

 

FM Script: 

Go to Layout ["Export"]

Perform Find:  IDNum = Get ( ScriptParameter )   // find our record with parameter from web

Execute SQL [No Dialog; DSN:Export; Calculated SQL Text: "INSERT INTO tblImport (Field1)

VALUES ('10')"   

(Perform without Dialog)

Set Field [Error_Capture; Get (LastODBCError)

 

I know that the script is running and finding the correct record by the ODBC error that is recorded: 

The Last ODBC Error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

 

Any help would be appreciated. Thanks.

 

  • 2 weeks later...
  • Newbies
Posted

Found the fix!  Created a sub-script using FM13 new option to PerformScriptOnServer to do the actual SQL insert and it worked. 

 

Thanks!

This topic is 3635 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.