Results 1 to 3 of 3

Thread: SQL insert fails and subsequent commands give same error

  1. #1

    SQL insert fails and subsequent commands give same error

    Hi,

    I used the following code to insert some data to a Lianja table through Lianja ODBC

    Code:
    lnconn = SQLCONNECT("LianjaODBC")
    
    ? SQLEXEC(lnconn,"CREATE table ctemp (cDesc c(200))")
    
    ? SQLEXEC(lnconn,"insert into ctemp (cDesc) values ('hello testing a question mark in a string value like ? and get error')")
    I got this error

    Connectivity error: COUNT field incorrect


    1) Why it's counting from my string during insert?


    and after this error any command via this same ODBC connection gave this error

    Connectivity error: Function sequence error

    I had to close the ODBC connection and reconnect again to issue any new command to Lianja server.

    How can these be avoided ?

    Regards
    Naeem

  2. #2
    Senior Member
    Join Date
    Jul 2013
    Location
    Ontario, Canada
    Posts
    658
    Hi Naeem,

    I too have had issues with using a ? in a string.
    The problem is that a ? is a special lianja character for displaying items in the console.

    I don't believe my issue was ever fully resolved although you could try to a substitution, as recommended by Lianja staff for a similar issue.
    Code:
    //  ** This is untested **
    strSQL = "insert into ctemp (cDesc) values ('hello testing a question mark in a string value like ? and get error')"
    strSQL = str_replace("?", '"' + chr(63) + '"', strSQL)
    SQLEXEC(lnconn,"&strSQL")
    Cory

  3. #3
    Hi Cory,

    Thank you for sharing a solution. I also want a solution from Lianja Team. I am more interested about the second part of my query of constant ODBC commands failure after this error.

    Every error should be specific to its own command as in other databases access via their ODBC. It should not effect the other commands. It forces me to close that ODBC connection handle as this makes it useless.

    Regards
    Naeem

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us