Closing connection in ASP

MagnoMagno Member Posts: 168
edited 2005-03-03 in Navision Attain
Hi,

i have to write a connection in ASP to Navision DB Server 3.6
it works, but when i close the connection in the code, and i look to the connection in the database, the connection is still shown.

So i conclude the connection in navision is still pending. in ASP however i am sure the object and the connection are closed.(checked with conn.state) and the i set conn=nothing. but still showing in navision itself...

Does anyone know how i can solve this?
There are no bugs, only random undocumented features...
---
My Blog: http://NAV-Magno.be

Comments

  • visgoldvisgold Member Posts: 21
    Hi

    I am doing the same thing as trying to connect navision native db with ASP let me show u the code but im not able to connect it as it gives the error

    Error Type:
    Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
    [Microsoft Business Solutions ApS][Microsoft Business Solutions-Navision ODBC Driver]ISAM error
    /asp/aa.asp, line 7

    code is


    Dim strSQL, strDSN
    Dim i
    strSQL="Select * from Customer"
    strDSN="DSN=Navision"
    Set rs=Server.CreateObject("ADODB.Recordset")
    rs.Open strSQL,strDSN

    Can u tell me pls what is the problem or source code for asp to connect navision table


    Thanks in advance

    Vishal
  • MagnoMagno Member Posts: 168
    visgold wrote:

    Dim strSQL, strDSN
    Dim i
    strSQL="Select * from Customer"
    strDSN="DSN=Navision"
    Set rs=Server.CreateObject("ADODB.Recordset")
    rs.Open strSQL,strDSN

    this won't work, try instead of rs.open strsql,strdsn
    make a connection first, this one must be given as 2nd parameter like:
    Dim strSQL, strDSN 
    Dim i 
    strSQL="Select * from Customer" 
    strDSN="DSN=Navision" 
    Set rs=Server.CreateObject("ADODB.Recordset") 
    set conn=server.createobject("ADODB.CONNECTION")
    conn.open strDSN
    rs.Open strSQL,conn
    
    ...
    ...
    
    rs.close
    set rs=nothing
    conn.close
    set conn = nothing
    

    don't forget to close connection and recordset and clear them, otherwise your webservers memory will be full quickly.
    There are no bugs, only random undocumented features...
    ---
    My Blog: http://NAV-Magno.be
  • visgoldvisgold Member Posts: 21
    Hi

    Thanks For ur reply

    Now i am using this code as per some more reviews and ur suugestion

    Code is

    <%
    Set conn=server.CreateObject("ADODB.Connection")
    Set RS = server.CreateObject("ADODB.RecordSet")
    dsn = "DSN=Navision"
    dsn = "DRIVER={C/ODBC 32 bit};"
    dsn = dsn & "UID=super;"
    dsn = dsn & "PWD=super;"
    dsn = dsn & "sName=local;"
    dsn = dsn & "NType=tcp;"
    dsn = dsn & "CN=CRONUS Dutch Ltd.;"
    dsn = dsn & "CSF=Yes;"
    dsn = dsn & "SERVER=N;"
    dsn = dsn & "RD=No;"
    dsn = dsn & "ML=2048;"
    dsn = dsn & "CD=No;"
    dsn = dsn & "BE=Yes;"
    dsn = dsn & "CC=Yes;"
    dsn = dsn & "RO=No;"
    dsn = dsn & "QTYesNo=Yes;"
    dsn = dsn & "IT=a-z,A-Z,0-9,_;"
    dsn = dsn & "OPT=Text"
    conn.Open dsn
    SQL="Select * from Customer"
    RS.Open SQL, conn
    %>

    Even with this code i am not able to connect with Navision Native DB and still i am getting ISAM Error
    ](*,)

    Please suggest me the solution

    Vishal
  • MagnoMagno Member Posts: 168
    make sure the hosts file is filled in(%windir%\system32\drivers\etc\hosts)
    with a line like (127.0.0.1 local)
    or instead of sName=local put sName=IPADDRESS
    If you run more than 1 server => the services file(same dir) must be filled in to.

    if it is not a database server the dsn must be something like
    (otherwise don't use the sName=local!!)

    DRIVER=C/ODBC 32 bit;
    SERVER=N;
    CN=CRONUS BELGIUM NV;
    RD=No;
    ML=2048;
    CD=No;
    BE=Yes;
    CC=Yes;
    RO=No;
    QTYesNo=Yes;
    IT=a-z,A-Z,0-9,_;
    OPT=Text;
    PPath=C:\Navision Clients\Navision Attain 3.6\Client;
    Database=c:\Navision Clients\Database.fdb;
    CSF=No

    I had a isam error to,
    the reason was the hosts file the first time and my server wasn't running the second time.
    There are no bugs, only random undocumented features...
    ---
    My Blog: http://NAV-Magno.be
  • visgoldvisgold Member Posts: 21
    Hi

    I have checked that hosts file and it is ok with that line u had suggested

    But still i am getting the same ISAM error

    ok can u tell me that should i write the whole code which i have shown to u in ASP file or just after assigning these vaues in DSN i have to write few lines like

    Set conn=server.CreateObject("ADODB.Connection")
    Set RS = server.CreateObject("ADODB.RecordSet")
    dsn = "DSN=Navision;"
    conn.Open dsn

    oh scahde

    that even works

    Please tell me where is the problem as i think u have did this task with the same profile and error.

    Thanks
  • visgoldvisgold Member Posts: 21
    can u tell me the right solution for this error

    Error Type:
    Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
    [Microsoft Business Solutions ApS][Microsoft Business Solutions-Navision ODBC Driver]ISAM error

    I tried both with dsn and dsn less but the error is same even one thing want to share if i make dsn less connection i am using provider msjetoledb 4.0 but the error comes that the provider is not properly installed.

    as i am getting again and again

    pls

    Vishal
  • itspeteritspeter Member Posts: 105
    visgold wrote:
    Now i am using this code as per some more reviews and ur suugestion

    Code is

    <%
    Set conn=server.CreateObject("ADODB.Connection")
    Set RS = server.CreateObject("ADODB.RecordSet")
    dsn = "DSN=Navision"
    dsn = "DRIVER={C/ODBC 32 bit};"
    dsn = dsn & "UID=super;"
    dsn = dsn & "PWD=super;"
    dsn = dsn & "sName=local;"
    dsn = dsn & "NType=tcp;"
    dsn = dsn & "CN=CRONUS Dutch Ltd.;"
    dsn = dsn & "CSF=Yes;"
    dsn = dsn & "SERVER=N;"
    dsn = dsn & "RD=No;"
    dsn = dsn & "ML=2048;"
    dsn = dsn & "CD=No;"
    dsn = dsn & "BE=Yes;"
    dsn = dsn & "CC=Yes;"
    dsn = dsn & "RO=No;"
    dsn = dsn & "QTYesNo=Yes;"
    dsn = dsn & "IT=a-z,A-Z,0-9,_;"
    dsn = dsn & "OPT=Text"
    conn.Open dsn
    SQL="Select * from Customer"
    RS.Open SQL, conn
    %>

    Vishal

    You got a missing "dsn & ", is that suppose to be missing?
    And, because of that, your code will end up having missing "dsn = "DSN=Navision;"" in your connection string.
    Regards,
    Peter Ng
  • MagnoMagno Member Posts: 168
    thats not important, its just a name you give your dsn. the DSN=XXXXX tag isn't needed to work correct
    There are no bugs, only random undocumented features...
    ---
    My Blog: http://NAV-Magno.be
Sign In or Register to comment.