ery();
Console.WriteLine("Values Inserted");
}
//删除整个表
Console.Write("Want to Delete All Records Present in the Table?(y/n) ");
ch = Console.ReadLine();
if (ch == "y")
{
ADOCommand DeleteTable = new ADOCommand("Delete from a1", s);
DeleteTable.ExecuteNonQuery();
Console.WriteLine("All Records Deleted From the Table");
}
//看所有记录
Console.Write("Want to See all the Records Present in the Table /Database (y/n)? ");
ch = Console.ReadLine();
if (ch == "y")
{
ADOCommand AllRecs = new ADOCommand("select * from a1", s);
ADODataReader r;
AllRecs.Execute(out r);
while(r.Read())
{
for(int i=0; i < r.FieldCount;i++)
{
Console.Write(r.GetValue(i)+ " ");
}
Console.WriteLine();
}
Console.WriteLine("All Records Displayed");
r.Close();
}
s.Close();
Console.ReadLine();
}
catch(System.Exception e)
{
Console.WriteLine(e.ToString());
Console.ReadLine();
}
return 0;
} // Main函数结束
} // Class结束
}// 名字空间结束