For what it's worth, I use a set of stored procedures called eConnect to do GP integrations. It may not be the most elegant solution, but it works fairly good. eConnect is also documented pretty well by Microsoft.
If you choose to use this kind of integration, it is wise to get familiar with the Dexterity Application. Learning the Dexterity Application helps a lot with object and table mappings and it should be a free download from Customer Source.
Here is an example of an eConnect stored procedure to create a customer record:
$sql = "declare @p115 int
set @p115=0
declare @p116 varchar(255)
set @p116=''
exec dbo.taUpdateCreateCustomerRcd
@I_vCUSTNMBR = '123456',
@I_vCUSTNAME = 'Company Name',
@O_iErrorState = @p115 OUTPUT,
@oErrString = @p116 OUTPUT
select @p115, @p116";
To execute it just do something like the following (using PHP ADODB in this example):
gp_execute_sp($sql);
function gp_execute_sp($sql, $transactions = true) {
global $DBGP;
if($transactions)
$DBGP->StartTrans();
$rs = $DBGP->Execute($sql);
if(is_object($rs) && !$rs->EOF) {
if($rs->fields['computed'] != 0) {
if($transactions)
$DBGP->FailTrans();
throw new Exception(get_error_desc($rs->fields['computed']));
}
} elseif(!is_object($rs)) {
if($transactions)
$DBGP->FailTrans();
throw new Exception("Database Connection Error.");
} else {
if($transactions)
$DBGP->FailTrans();
throw new Exception("Stored proceedure did not return a result.");
}
if($transactions)
$DBGP->CompleteTrans();
}
function get_error_desc($value) {
global $DBGP;
if(is_numeric($value)) {
$result = "No Error Available";
$sql = "SELECT ErrorDesc FROM DYNAMICS..taErrorCode WHERE ErrorCode=?";
$rs = $DBGP->execute($sql, array($value));
if(!$rs->EOF) {
$result = $rs->fields['ErrorDesc'];
}
} else {
$result = $value;
}
return $result;
}