Community
Showing results for 
Search instead for 
Do you mean 
Reply

Failed to Open a Connection to the Database

New Member
Posts: 8
Country: USA

Failed to Open a Connection to the Database

Hi All,

 

Using the "LogOn" method to access the Demo database, I get the subject error. Further error details are:

 

'Act.Data.IPAddressConnectionDatabaseAccessException' occurred in Act.Framework.dll

 

Here is my rudimentary code:

 

Public Sub GetActContact()

Dim ACTFM As New Act.Framework.ActFramework
Dim Contact As VariantType

ACTFM.LogOn("c:\Program Files (x86)\ACT\Act10Demo.pad", "chris huffman", "")
Contact = ACTFM.Contacts.GetMyRecord


End Sub

 

Using VBNet 2013 Express with .NETFramework 4 (originally was using 4.5 with the same result).

 

I'm certain this is something really stupid I'm overlooking, but I cannot seem to ID it.

 

Help PLEASE! I'm sure I can make some good progress once I get past this hurdle without bothing you all.

 

Larry

Silver Super Contributor
Posts: 2,328
Country: USA

Re: Failed to Open a Connection to the Database

ACT! 2010 uses .NET 2.0.  You can use up to .NET 3.5 as long as you don't use any 3.5 only features or at least I use 3.5 and I've never had any problems.  You will need to target from 2.0 to 3.5 to get it to work.


Stan


If you would like to get more out of ACT! you can find an ACT! Certified Consultant near you by going to:www.act.com/acc.
-------------------------------------------------------------------------------------
Stan Smith
ACT! Certified Consultant
ADS Programming Services, Inc.
(205) 222-1661
www.adsprogramming.com
www.actwebhosting.com
Click Here to Purchase Act!
New Member
Posts: 8
Country: USA

Re: Failed to Open a Connection to the Database

Hi Stan,

 

Thanks for the quick response.

 

I should have said so in my original post, but I am using ACT Pro v16 and ACT v16 SDK.

 

Is that still limited to .NETFramework 3.5?

 

Larry

Silver Super Contributor
Posts: 2,328
Country: USA

Re: Failed to Open a Connection to the Database

No you need to use .NET 4 with ACT! 2013 and later.  The reason I assumed you were using ACT! 2010 was because you are attempting to open the Act2010demo database.  I suspect the issue is that you've never opened the database and it needs to convert the database before it will work with ACT! v16 so you're getting the error message.  Open the database, convert it and close it and see if it still happens.

 

Stan


If you would like to get more out of ACT! you can find an ACT! Certified Consultant near you by going to:www.act.com/acc.
-------------------------------------------------------------------------------------
Stan Smith
ACT! Certified Consultant
ADS Programming Services, Inc.
(205) 222-1661
www.adsprogramming.com
www.actwebhosting.com
Click Here to Purchase Act!
New Member
Posts: 8
Country: USA

Re: Failed to Open a Connection to the Database

Hi Stan,

 

You were spot on! How stupid of me.

 

I have changed the application to use .NET4 and updated the path to the 2014 Demo, but now I'm getting this message:

 

An unhandled exception of type 'System.NullReferenceException' occurred in Act.Framework.dll

Additional information: Object reference not set to an instance of an object.

 

Here is my updated code:

 

Public Sub GetActContact()

Dim ACTFM As New Act.Framework.ActFramework
Dim Contact As VariantType

ACTFM.LogOn("C:\Users\Public\Documents\ACT\ACT Data\Databases\ACT2014Demo.PAD", "chris huffman", "")
Contact = ACTFM.Contacts.GetMyRecord


End Sub

 

Do I need to set a variable as the ACTFM.LogOn?

 

Thanks in advance.

 

Larry

Silver Super Contributor
Posts: 2,328
Country: USA

Re: Failed to Open a Connection to the Database

The logon is probably failing.  Put a Try..Catch in and see if you get a better error message.  You should probably use the type "ACT.Framework.Contacts.Contact" for the Contact variable.

 

I tested with your code and it worked fine for me.  I was curious because I hadn't used ACTFM.MyRecord before.  It makes sense that it would work but I haven't needed to use it before so I thought I would test it to see if that was what was causing your problem.

 

Stan


If you would like to get more out of ACT! you can find an ACT! Certified Consultant near you by going to:www.act.com/acc.
-------------------------------------------------------------------------------------
Stan Smith
ACT! Certified Consultant
ADS Programming Services, Inc.
(205) 222-1661
www.adsprogramming.com
www.actwebhosting.com
Click Here to Purchase Act!
New Member
Posts: 8
Country: USA

Re: Failed to Open a Connection to the Database

Thanks again for the quick response, Stan.

 

Is it possible that the SDK will not work with a trial version of ACT? I've run into that with other SDK's.

 

If that is the case, is there somewhere where developers can get a working version of ACT to test with?

 

 

Larry

Silver Super Contributor
Posts: 2,328
Country: USA

Re: Failed to Open a Connection to the Database

No.  It works with the trial version of ACT!.  I do that all the time.


Stan


If you would like to get more out of ACT! you can find an ACT! Certified Consultant near you by going to:www.act.com/acc.
-------------------------------------------------------------------------------------
Stan Smith
ACT! Certified Consultant
ADS Programming Services, Inc.
(205) 222-1661
www.adsprogramming.com
www.actwebhosting.com
Click Here to Purchase Act!
New Member
Posts: 8
Country: USA

Re: Failed to Open a Connection to the Database

OK, scratch that idea.

 

I'm not sure what you meant earlier when you said to insert a Try...Catch to get a better error message. Could you elaborate?

 

Thanks,

 

Larry

Silver Super Contributor
Posts: 2,328
Country: USA

Re: Failed to Open a Connection to the Database

 

Public Sub GetActContact()

 

Try

    Dim ACTFM As New Act.Framework.ActFramework
    Dim Contact As Act.Framework.Contacts.Contact

    ACTFM.LogOn("c:\Program Files (x86)\ACT\Act10Demo.pad", "chris huffman", "")
    Contact = ACTFM.Contacts.GetMyRecord

Catch ex as Exception

    Messagebox.Show(ex.tostring)

End Try


End Sub

 

Stan


If you would like to get more out of ACT! you can find an ACT! Certified Consultant near you by going to:www.act.com/acc.
-------------------------------------------------------------------------------------
Stan Smith
ACT! Certified Consultant
ADS Programming Services, Inc.
(205) 222-1661
www.adsprogramming.com
www.actwebhosting.com
Click Here to Purchase Act!