nukkumatti, I am attempting to follow your suggestion, but when I do, the command string I get back is "exec dbo.uspJobAndContract" which is the correct name of the stored proc I am trying to execute. However, it looks like I should be getting back the select statement from my proc. Any idea what I might be doing wrong? Below is my sproc and jscript
ALTER PROCEDURE [dbo].[uspJobAndContract]
-- Add the parameters for the stored procedure here
--@JobNumber char(6) = 444139
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;SELECT TOP (100) PERCENT PARFLS.dbo.OverheadPool.Description1 AS Division,
PARFLS
.dbo.WorkLocation.Description_1 + ' (' + JM.Office_Number + ')' AS [Office/Sector], JM.Job_Number, PARFLS.dbo.ContractMaster.Customer_Number, PARFLS.dbo.ContractMaster.Customer_Name AS Customer, JM.Job_Description,
JM
.ProjMgrLastName, JM.ProjMgrFirstName, PARFLS.dbo.ContractMaster.Contract_Number, PM.EMail_Name, JM.Office_Number
FROM
PARFLS.dbo.JobMaster AS JM INNER JOIN
PARFLS
.dbo.WorkLocation ON JM.Office_Number = PARFLS.dbo.WorkLocation.Work_Location INNER JOIN
PARFLS
.dbo.OverheadPool ON PARFLS.dbo.WorkLocation.Overhead_Pool = PARFLS.dbo.OverheadPool.Pool_Master LEFT OUTER JOIN
PARFLS
.dbo.ContractMaster ON JM.Contract_Master_Number = PARFLS.dbo.ContractMaster.Contract_Number LEFT OUTER JOIN
PARFLS
.dbo.HrEmployee AS PM ON JM.PM_Employee_Number = PM.Employee_Number
--WHERE (JM.Job_Number=@JobNumber)
WHERE
(JM.Job_Number='123456')
END
function msoxd_my_JobNumber::OnAfterChange(eventObj) {
// A field change has occurred and the DOM is writable. Write code here to respond to the changes.
objADOAdapter = XDocument.DataObjects("Job Data").QueryAdapter;
var command = objADOAdapter.Command;
//you receive back a string "select * from tblEmployess where name = 'Input'"
var query = command.replace("'123456'", "'" + XDocument.DOM.selectSingleNode("/my:myFields/my:JobNumber").text + "'");
// replace your "Input parameter with the value you want"
objADOAdapter.Command = query;
objADOAdapter.Query();
objADOAdapter.Command = command;
}