Results 1 to 12 of 12

Thread: [RESOLVED] Issue with OleDb : [2002] works, [2005] fails

  1. #1

    Thread Starter
    pathfinder NotLKH's Avatar
    Join Date
    Apr 2001
    Posts
    2,397

    Resolved [RESOLVED] Issue with OleDb : [2002] works, [2005] fails

    I've been using ODBC to query for data from my companies sqlanywhere database, but recently a particular query failed.

    My coworker has been using OleDB for similar transactions, and his query with the same sql string worked without issue.

    So, I built a quick test in VB.Net 2002 using OleDB methods, and it also worked without issue.

    So then I created the exact same test in .Net 2005, and it failed with the following error:

    System.Data.OleDb.OleDbException: 'ASAProv' failed with no error message available, result code: DB_E_ERRORSOCCURRED(0x80040E21).
    at System.Data.OleDb.OleDbDataReader.ProcessResults(OleDbHResult hr)
    at System.Data.OleDb.OleDbDataReader.GetRowDataFromHandle()
    at System.Data.OleDb.OleDbDataReader.GetValueBinding(MetaData info)
    at System.Data.OleDb.OleDbDataReader.GetValue(Int32 ordinal)
    at System.Data.OleDb.OleDbDataReader.get_Item(Int32 index)
    at New_Ole.Form1.GET_TASK_PARM1(String mTaskID, String& mErrMsg) in C:\Documents and Settings\lou\My Documents\Visual Studio 2005\Projects\New_Ole\New_Ole\Form1.vb:line 87



    However, if I run the 2005 program on my coworkers machine, it faultlessly works without issue.

    We both installed 2005 at the same time, and as far as I can tell, we are both updated to the same level.

    I am stumped as to how to what I should do to get this working.

    HELP!

    {BTW, the data I was trying to collect is only 8985 characters long, and the data format is a LONG VARCHAR}

    -Lou

  2. #2
    Hyperactive Member .NetNinja's Avatar
    Join Date
    Oct 2008
    Location
    USA
    Posts
    281

    Re: Issue with OleDb : [2002] works, [2005] fails

    What is the code for line 87?
    "Don't try to be a great man. Just be a man and let history make its own judgement."

  3. #3
    PowerPoster Jenner's Avatar
    Join Date
    Jan 2008
    Location
    Mentor, OH
    Posts
    3,712

    Re: Issue with OleDb : [2002] works, [2005] fails

    Can you post the code with the routine in it? This looks like an odd one.
    My CodeBank Submissions: TETRIS using VB.NET2010 and XNA4.0, Strong Encryption Class, Hardware ID Information Class, Generic .NET Data Provider Class, Lambda Function Example, Lat/Long to UTM Conversion Class, Audio Class using BASS.DLL

    Remember to RATE the people who helped you and mark your forum RESOLVED when you're done!

    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe. "
    - Albert Einstein

  4. #4
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: Issue with OleDb : [2002] works, [2005] fails

    What MDAC version do you have in your machine?
    Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
    - Abraham Lincoln -

  5. #5

    Thread Starter
    pathfinder NotLKH's Avatar
    Join Date
    Apr 2001
    Posts
    2,397

    Re: Issue with OleDb : [2002] works, [2005] fails

    On My Machine, in 2005, It jumps from:

    Code:
    If Not IsDBNull(myReader(0)) Then
    to the exception handling in:

    Code:
        Public Function GET_TASK_PARM1(ByVal mTaskID As String, ByRef mErrMsg As String) As Boolean
            Try
                Dim myCommand As Data.OleDb.OleDbCommand
                Dim myReader As Data.OleDb.OleDbDataReader
    
    
                Dim mSql As String
                mSql = "select parm1 from cms.tasks where task_id = '" & mTaskID & "'"
    
                myCommand = New Data.OleDb.OleDbCommand("", MyODBCConn)
                myCommand.CommandText = mSql
    
                myReader = myCommand.ExecuteReader()
    
                If myReader.Read Then
                    If Not IsDBNull(myReader(0)) Then
                        mErrMsg = myReader(0)
                    Else
                        mErrMsg = "NULL"
                    End If
                Else
                    mErrMsg = "FAILED!"
                End If
                myReader.Close()
                myCommand.Dispose()
                Return True
            Catch mErr As System.Exception
                mErrMsg = mErr.Message
                Clipboard.SetDataObject(mErr.ToString)
                MessageBox.Show(mErr.ToString)
                Return False
            End Try
        End Function
    but not in the 2002 environment on my machine,
    nor in the 2005 environment on my coworkers machine.

    Also, as an FYI:

    Even though the connection is called "MyODBCConn", it is a relic naming convention.
    It is defined as:

    Public MyODBCConn As OleDb.OleDbConnection


    and it is opened via:

    Code:
        Public Function CONNECT_IF_POSSIBLE_OLEDB(ByRef mDevMode As Boolean) As Boolean
            Try
                If Not IS_CONNECTED Then
                    If mDevMode Then
                        mConnectionString = MyDevConnectionString
                    Else
                        mConnectionString = MyCMSConnectionString
                    End If
                    MyODBCConn = New Data.OleDb.OleDbConnection(mConnectionString)
                    MyODBCConn.Open()
                    IS_CONNECTED = True
    
                End If
                Return True
            Catch mErr As System.Exception
                Clipboard.SetDataObject(mErr.Message, True)
                MessageBox.Show(mErr.Message)
                Return False
    
            End Try
        End Function

  6. #6

    Thread Starter
    pathfinder NotLKH's Avatar
    Join Date
    Apr 2001
    Posts
    2,397

    Re: Issue with OleDb : [2002] works, [2005] fails

    Quote Originally Posted by stanav
    What MDAC version do you have in your machine?
    My System, Windows XP Professional Version 2002, SP3, does not have the key as indicated on:

    http://en.wikipedia.org/wiki/Microso...ess_Components

    And downloading the component checker that was suggested indicates the attached image:
    Attached Images Attached Images  

  7. #7
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: Issue with OleDb : [2002] works, [2005] fails

    So you've got MDAC 2.8 which is already up to date. We can eliminate this as a cause. And I don't see anything obvious that could throw an exception in your code.

    One more question, what database are you connecting to?
    Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
    - Abraham Lincoln -

  8. #8

  9. #9
    PowerPoster Jenner's Avatar
    Join Date
    Jan 2008
    Location
    Mentor, OH
    Posts
    3,712

    Re: Issue with OleDb : [2002] works, [2005] fails

    Instead of: myReader(0)
    Use: myReader.Items(0)
    My CodeBank Submissions: TETRIS using VB.NET2010 and XNA4.0, Strong Encryption Class, Hardware ID Information Class, Generic .NET Data Provider Class, Lambda Function Example, Lat/Long to UTM Conversion Class, Audio Class using BASS.DLL

    Remember to RATE the people who helped you and mark your forum RESOLVED when you're done!

    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe. "
    - Albert Einstein

  10. #10

    Thread Starter
    pathfinder NotLKH's Avatar
    Join Date
    Apr 2001
    Posts
    2,397

    Re: Issue with OleDb : [2002] works, [2005] fails

    Quote Originally Posted by Jenner
    Instead of: myReader(0)
    Use: myReader.Items(0)
    Good Suggestion!
    Code:
                If myReader.Read Then
    
                    If Not IsDBNull(myReader.Item(0)) Then
                        mErrMsg = myReader.Item(0)
                    Else
                        mErrMsg = "NULL"
                    End If
                Else
                    mErrMsg = "FAILED!"
                End If
    Didn't work.
    Same error.
    FYI:
    I went with .Item(0), as .Items(0) does not exist.

  11. #11

    Thread Starter
    pathfinder NotLKH's Avatar
    Join Date
    Apr 2001
    Posts
    2,397

    Re: Issue with OleDb : [2002] works, [2005] fails

    Yay!

    I searched for new sybase anywhere updates,
    Found one,
    Installed it,
    And now my .Net 2005 works!


    And My .Net 2002 still works!

    woohoo!


    Thanks everybody!


  12. #12
    PowerPoster Jenner's Avatar
    Join Date
    Jan 2008
    Location
    Mentor, OH
    Posts
    3,712

    Re: [RESOLVED] Issue with OleDb : [2002] works, [2005] fails

    Haha... that figures. The drivers and outdated components will get you every time. I one time spend a week trying to fix something that was corrected in a patch to the controls I was using.

    Glad you got it working!
    My CodeBank Submissions: TETRIS using VB.NET2010 and XNA4.0, Strong Encryption Class, Hardware ID Information Class, Generic .NET Data Provider Class, Lambda Function Example, Lat/Long to UTM Conversion Class, Audio Class using BASS.DLL

    Remember to RATE the people who helped you and mark your forum RESOLVED when you're done!

    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe. "
    - Albert Einstein

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width