Using CFront in ASP

Hi I am trying to read the data from navision database using CFront, in an ASP page. The variable declaration for the CFront succeeds. The database opens with the supplied user id and password. The compnay also opens without giving any errors. When i try to open a table it gives me error for the OpenTable Function of CFront that ‘Type mismatch’. After i went through the code, i found out that the OpenTable function needs to be passed two arguments as datatype long but in VBScript all the variables are of type variants. I tried to pass the variables by using the CLng function in VBScript but even that does not work. Is there a way out of this? Regards Akshay

Hi, Please before using any operation on Table Open Company as U opened Database Thanks

I have opened the company. After that only i am using the function OpenTable. And that is where it is giving me the error. Regards Akshay

Hello Can annyone plz send me some sample code which can be used to access Navision Database using CFront in ASP. Regards Akshay

Can you not use something like CLng to convert the variable to a Long? Django

I did try using CLng. But it does not work. Regards Akshay

Akshay, It maybe easier if you post the problematic code for us to look at. I’m not a VBScript developer, but I have done quite a bit of VB development and maybe able to shed some light if I can see the code. [:)]

Here is the relevant code. The same has been posetd by me on But no reply has come from there as yet. Read below to get the picture of the problem. If u require any further clarifications plz feel free to post the same ----------------------------------------------------------------------------- Hi I am trying to use CFront in ASP to read data from Navision Database. I am successful in opening the database with a user id and password. I am also successful in opening a company from the database. When i try to open a table, i get the following error ---------------------------------------------- Microsoft VBScript runtime error ‘800a000d’ Type mismatch: ‘OpenTable’ ---------------------------------------------- These are the relevant lines of code ---------------------------------------------- Dim ok Dim rec Dim ctable ok = CFRONT1.OpenTable(ctable,18) ---------------------------------------------- and the error comes for the last line what is the possible source of the error and how can it be rectified? As far as i have understood the error has come because of the variable ‘ctable’ The variables in VBScript are of type Variant and the function requires the input of type Long. I tried to use the CLng function of VBScript on the variable ‘ctable’ but still it gives the same error. Is it possible to retrieve data from navision database from an asp page? Regards Akshay

Akshay, i’m sure it’s possible to retreive data from Navision and display it in an ASP page. Silly question, but how did you use the CLng function? Did you do something like; newlongvariable = CLng (cTable) ok = CFRONT1.OpenTable(newlongvariable,18) ? or did you; ok = CFRONT1.OpenTable(CLong(ctable),18) ? I noticed with word automation I had to use the first example in some cases and was wondering if this had something to do with it?! Sorry if this is no help. [V]

Hi Connull I tried using the CLng function in both the ways But neither works!!! Can anyone suggest something??? Regards Akshay


Originally posted by akshay99 These are the relevant lines of code ---------------------------------------------- Dim ok Dim rec Dim ctable ok = CFRONT1.OpenTable(ctable,18) ----------------------------------------------

Cant you just define ctable as long: Dim ctable as Long ?