株式会社テクナレッジ

サンプルコード 1

 string connStr;
 connStr = "Provider=PervasiveOLEDB.7.90;Data Source=Demodata;Location=Demodata;" +
 			"Cache Authentication=False;" +
           "Encrypt Password=False;Mask Password=False;" +
           "Persist Encrypted=False;Persist Security Info=False;" +
           "Impersonation Level=Anonymous;Mode=ReadWrite;Protection Level=None";
 OleDbConnection conn = new OleDbConnection(connStr);
 try
 {
   conn.Open();
   string sql = "select First_Name from person";
   OleDbCommand cmd = new OleDbCommand(sql, conn);
   OleDbDataReader reader = cmd.ExecuteReader();
   while(reader.Read())
   {
     listBox1.Items.Add(reader["First_Name"]);
   }
   conn.Close();
 }
 catch( OleDbException e)
 {
   Console.WriteLine(e.ToString());
 }