I have this working with the Sage 300 company database but need to read from another SQL database.
Does anyone have some sample code to get me started?
Any and All advice greatly appreciated,
Dana
I have this working with the Sage 300 company database but need to read from another SQL database.
Does anyone have some sample code to get me started?
Any and All advice greatly appreciated,
Dana
So would this work?
SELECT SomeField, SomeOtherField FROM CRM.dbo.Lead
or do I have to specify the server name too? It is the same server
Dana
FWIW, CRM..Lead will work, too. The 'dbo' is implied, so it's less typing for us SQL programmers.
Thanks Jay, my fingers get tired with all this typing.
Okay, I got it reading the CRM data but I now have an issue with the format of the variables for the date fields. After the SQL read I use Fetch to assign the data to variables like below
o While csTemp.Fetch = True
mCRMSalesPerson = csTemp.Fields.FieldByName("Lead_AssignedUserID").Value
mLeadDate = csTemp.Fields.FieldByName("Lead_CreatedDate").Value
mSoldDate = csTemp.Fields.FieldByName("lead_companysolddate").Value
mSource = csTemp.Fields.FieldByName("lead_companysource").Value
I have mLeadDate and mSoldDate dimensioned as 'Date'. This doesn't work. I thought I'd try Dim as String but that doesn't work either.
What should I be using?
Okay, I got it reading the CRM data but I now have an issue with the format of the variables for the date fields. After the SQL read I use Fetch to assign the data to variables like below
o While csTemp.Fetch = True
mCRMSalesPerson = csTemp.Fields.FieldByName("Lead_AssignedUserID").Value
mLeadDate = csTemp.Fields.FieldByName("Lead_CreatedDate").Value
mSoldDate = csTemp.Fields.FieldByName("lead_companysolddate").Value
mSource = csTemp.Fields.FieldByName("lead_companysource").Value
I have mLeadDate and mSoldDate dimensioned as 'Date'. This doesn't work. I thought I'd try Dim as String but that doesn't work either.
What should I be using?
*Community Hub is the new name for Sage City