Error Opening a Table in MS SQL Server

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • smoi
    New Member
    • Feb 2007
    • 6

    Error Opening a Table in MS SQL Server

    Hello... I need help with the error I encounter when I tried to open a Table in MS SQL Server. I have the following code in VB6.


    Code:
    Dim rs As ADODB.Recordset
    
    Set rs = New ADODB.Recordset
    rs.open "TableName", adoConn, adOpenKeyset, adLockOptimistic

    where adoConn is my Connection to the Ms SQL Server Database.


    The error is:
    -2147217900 The request for procedure 'TableName' failed because 'TableName' is a table object.

    Is there anything wrong with my line of code? Or something else I miss?

    Thank you.
    Smoi
    Last edited by willakawill; Feb 7 '07, 01:01 AM. Reason: please use code tags when posting code
  • scripto
    New Member
    • Oct 2006
    • 143

    #2
    check out this kb article

    Comment

    • willakawill
      Top Contributor
      • Oct 2006
      • 1646

      #3
      Try this:
      Code:
      rs.open "SELECT * FROM TableName", adoConn, adOpenKeyset, adLockOptimistic

      Comment

      • ITHSC
        New Member
        • Feb 2007
        • 1

        #4
        This may help...

        Code:
        rs.open "SELECT * FROM TableName", adoConn, adOpenKeyset, adLockOptimistic, adCmdTable

        Comment

        • vijaydiwakar
          Contributor
          • Feb 2007
          • 579

          #5
          Originally posted by smoi
          Hello... I need help with the error I encounter when I tried to open a Table in MS SQL Server. I have the following code in VB6.


          Code:
          Dim rs As ADODB.Recordset
          
          Set rs = New ADODB.Recordset
          rs.open "TableName", adoConn, adOpenKeyset, adLockOptimistic

          where adoConn is my Connection to the Ms SQL Server Database.


          The error is:
          -2147217900 The request for procedure 'TableName' failed because 'TableName' is a table object.

          Is there anything wrong with my line of code? Or something else I miss?

          Thank you.
          Smoi
          basically at a glance it seems to be s wrong code u have to use complete sql qry as given above by all
          but.........
          u can also use this with the help of command object

          check it out

          Comment

          Working...