CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2001
    Posts
    33

    Command Object Problem

    Following is part of my code :

    ..............
    ..............

    connString = "Provider=SQLOLEDB.1;" & _
    "Data Source=JYP;" & _
    "Initial Catalog=CUSTOMER;" & _
    "Integrated Security=SSPI;" & _
    "Persist Security Info=false"

    'Use client-side cursor
    conn.CursorLocation = adUseClient

    'Open the connection
    conn.Open connString

    'cmmd is a command object
    cmmd.ActiveConnection = connString
    cmmd.CommandType = adCmdStoredProc
    cmmd.CommandText = "StartEditCls"

    rs.CursorType = adOpenStatic
    rs.LockType = adLockReadOnly
    rs.ActiveConnection = conn

    'Use Stored Procedure---named StartEditCls
    set rs = cmmd.Execute



    At the beginning, there is no record in the table.
    But I found out that rs.recordcount = -1 , not 0.
    Why ????
    Can anyone explain it to me?
    Thanks


  2. #2
    Join Date
    Feb 2000
    Location
    Ireland
    Posts
    808

    Re: Command Object Problem

    -1 means that it cant return the recordcount
    if you put conn.CursorLocation = adUseClient then test the recordcount it will return it correctly


  3. #3
    Join Date
    Mar 2001
    Posts
    91

    Re: Command Object Problem

    recordcount will always have -1 for a forward only cursors and for all other cursor types u can get the exact recordcount only when u access the last record in the recordset.It has nothing to do with client side cursor or server side cursor i suppose


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

Featured