Community
Showing results for 
Search instead for 
Do you mean 
Reply

Code example - OLEDB2 provider access

Nickel Elite Contributor
Posts: 937
Country: USA

Code example - OLEDB2 provider access

I know there are already samples of accessing OLEDB2 provider programatically, but I wanted to share another and offer some views on how the provider could be used in code for certain operations...

 

 Included in attachment is source code + samples.dll (extract to tools directory) and connections.udl file (extract to \Act for Windows directory and configure for your system).

 

 In this example I'm retrieving the avg of all closed won opportunities and displaying it in the Opportunity control.  I'm using the OLEDB2 provider because I can query this quite simply using a SQL statement and aggregate functions and I've found SQL handles these types of operations fairly efficiently.  If you find yourself writing code that pulls a list then iterates through the list in a cursor based operation comparing data values you might want to consider rewriting your code to use the provider and set based operations.  In general a foreach or while loop through a API generated list to evaluate data is going to be more resource intensive than a SQL query for the same list.  You can still cast your SQL results into an array and loop through the results for data posting via the SDK even though the data arrived from the provider.  

 

Any additional input?  

Avid Listener
Posts: 44
Country: USA

Re: Code example - OLEDB2 provider access

Thanks, great example a perfect time.
DBS
Avid Listener
Posts: 44
Country: USA

Re: Code example - OLEDB2 provider access

Ok, trying to test your sample.dll

 

Found control. Modified udl for my database - tested fine

 

Added control to Opportunity form

 

Nothing shows up - am I missing something?

 

Thanks

DBS
Avid Listener
Posts: 44
Country: USA

Re: Code example - OLEDB2 provider access

retraction. Field size has to be increased from as dropped onto the form to about 3x the size.

 

Thanks, great work

DBS
Nickel Elite Contributor
Posts: 937
Country: USA

Re: Code example - OLEDB2 provider access

Do you have any opportunities in the stateu of Closed - Won in your db?

 

Allen

Tuned Listener
Posts: 45
Country: Poland

Re: Code example - OLEDB2 provider access

[ Edited ]

Hi there, i m kinda new in act programming and i want to learn how to create such an act addons , could u please give more info about how to run your plugin. i use act premium 2011 , 

 

also if i run it, how can i know it works ? where will be the data, you get from DB , show in act (oportunity or oportunity list )? should i do sth else to view this avg ? it is stated that it will be on oportunity controll but how can i get this controll ? . 

 

 with what language is it created  ?

THQ