CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Threaded View

  1. #1
    Join Date
    Dec 2009
    Posts
    18

    [RESOLVED] OleDbDataReader not pulling all results

    Can't seem to get all the results from my reader to add into my ArrayList

    Here is the database info
    Code:
    Table: Servers
    Field1: ID *Auto Gen ID field*
    Field2: CleintID
    Field3: SName
    Field4: SIP
    
    Data Stored within table
    1 | 1234 | TestServer1 | 172.17.0.10
    2 | 1234 | TestServer2 | 172.17.0.20
    With the following code my ArrayList count "should" equal 4 but I get 2 and the results stored are as followed
    DeHolder[0] contains TestServer1
    DeHolder[1] contains 172.17.0.20
    Why am I not getting entry 1's SIP and entry 2's SName ?
    The contents of EncHolder matches so its nothing to do with my Decrypt method.

    Here is the code Field1 = SName | Field2 = SIP | Table = Servers | AccountID = 1234
    Code:
    int x = 0;
    ArrayList EncHolder = new ArrayList();
    ArrayList DeHolder = new ArrayList();
    Global.cmd.CommandText = "SELECT " + Field1 + ", " + Field2 + " FROM " + Table + " WHERE ClientID ='" + AccountID + "'";
    OleDbDataReader reader = Global.cmd.ExecuteReader();
    while (reader.Read())
         {
             EncHolder.Add(reader.GetValue(x).ToString());
             DeHolder.Add(Crypto.Decrypt(reader.GetValue(x).ToString(), true));
             x = x + 1;
         }            
    reader.Close();
    What am I missing?
    Thanks in advance
    Last edited by Omegadarkest; May 5th, 2011 at 11:05 PM.

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