Results 1 to 3 of 3

Thread: geting all data from database

  1. #1

    Thread Starter
    <?="Moderator"?> john tindell's Avatar
    Join Date
    Jan 2002
    Location
    Brighton, UK
    Posts
    1,099

    geting all data from database

    hey, can some please tell me how i can get this code to work
    Code:
    System.Data.OleDb.OleDbConnection s;
    s = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=f:\\c#\\myDB.mdb");
    s.Open();
    System.Data.OleDb.OleDbCommand c;
    c=new System.Data.OleDb.OleDbCommand("select * from a1",s);
    System.Data.OleDb.OleDbDataReader r;
    r= c.ExecuteReader();
    System.Console.WriteLine(r.Read());
    int i;
    for(i=0;i<=r.Read.count;i++){
    System.Console.WriteLine("{0}",r.GetValue(i));
    }
    im trying it to get all the data in table a1
    thnx

  2. #2

    Thread Starter
    <?="Moderator"?> john tindell's Avatar
    Join Date
    Jan 2002
    Location
    Brighton, UK
    Posts
    1,099
    hey thanks ive kinda got it working, the only thing, is that i can get the first value. my data starts from 1 though to 6 in the first column but it only displays 2 to 6???

  3. #3

    Thread Starter
    <?="Moderator"?> john tindell's Avatar
    Join Date
    Jan 2002
    Location
    Brighton, UK
    Posts
    1,099
    dnt worry i got it to work now

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