Home All Groups Group Topic Archive Search About

Small bit of code from VB6 to VB.net - desperate need of help

Author
23 Mar 2006 11:55 AM
garyusenet
I have been trying to interface with my act database using .net and act
api's. I was originally using c# but it wouldn't connect to the
database. I tried VB in desperation and it is connecting!

Now i have hit another problem and i'm sure its down to the fact that
the code was written years ago, and needs a bit of modification for
..net can you take a look at these 12 lines of code and let me know how
to get it to work in .net please...

dim objDatabase as object
Set objDatabase = CreateObject("ACTOLE.DATABASE")
objDatabase.Open dbname

by changing the last line to : objDatabase.Open("path\database.dbf")
I've managed to open the database with no problem. I know this because
I used objDatabase.LastError and it returned an error code of 0 which
means success. And before in C# I was getting error code 87 which means
can't connect.
---
Now these next eight lines seem to be the problem, please have a look
and see if you can help me. The exame code continues as follows...

Dim tavleObject As Object
Set tableObject = objDatabase.CONTACT

tableObject.MoveFirst

(the above line generates the first error, and complains about a Null
reference exception being unhandled)

dim strOutput as String
strOutput = tableObject.Data(CF_Name)

the above line doesn't work in .net either and this is what is giving
me the problem I think...

I look forward to your comments

Gary

Author
23 Mar 2006 12:03 PM
garyusenet
dim table i mean sorry  about the poor typing, but i'm late for a
meeting, ill check again in an hour and hopefully there will be some
good input from you experts!
Author
23 Mar 2006 12:35 PM
Stephany Young
What happened to the Interop library you generated and why aren't you using
it?

Add it as a reference and you should be in business.

    Dim objDatabase As New ACTOLE.DATABASE

    objDatabase.Open(dbname)

    Dim tableObject As ACTOLE.CONTACT = objDatabase.CONTACT

    tableObject.MoveFirst()

    Dim strOutput as String = tableObject.Data(CF_Name)

    etc. ....



<garyuse***@myway.com> wrote in message
Show quoteHide quote
news:1143114907.839801.117440@g10g2000cwb.googlegroups.com...
>I have been trying to interface with my act database using .net and act
> api's. I was originally using c# but it wouldn't connect to the
> database. I tried VB in desperation and it is connecting!
>
> Now i have hit another problem and i'm sure its down to the fact that
> the code was written years ago, and needs a bit of modification for
> .net can you take a look at these 12 lines of code and let me know how
> to get it to work in .net please...
>
> dim objDatabase as object
> Set objDatabase = CreateObject("ACTOLE.DATABASE")
> objDatabase.Open dbname
>
> by changing the last line to : objDatabase.Open("path\database.dbf")
> I've managed to open the database with no problem. I know this because
> I used objDatabase.LastError and it returned an error code of 0 which
> means success. And before in C# I was getting error code 87 which means
> can't connect.
> ---
> Now these next eight lines seem to be the problem, please have a look
> and see if you can help me. The exame code continues as follows...
>
> Dim tavleObject As Object
> Set tableObject = objDatabase.CONTACT
>
> tableObject.MoveFirst
>
> (the above line generates the first error, and complains about a Null
> reference exception being unhandled)
>
> dim strOutput as String
> strOutput = tableObject.Data(CF_Name)
>
> the above line doesn't work in .net either and this is what is giving
> me the problem I think...
>
> I look forward to your comments
>
> Gary
>