日期:2014-05-17  浏览次数:20910 次

C#连接读取Acess数据库的中文字段名(列名)的问题。。菜鸟真心求教
我新建了一个Acess数据库(.mdb),里面建了一张表,有ID,甲,乙,丙,丁几个列。。我想通过C#一个循环读取这几个列中的数字。我是这样做的,可是接下去该怎么写呢???菜鸟真心求指导!!!
[code=C#][/code]string strConnection = "Provider=Microsoft.Jet.OleDb.4.0;";
  strConnection += @"Data Source=E:\Calculation\DBtest.mdb";
  OleDbConnection objConnection = new OleDbConnection(strConnection);
  objConnection.Open(); //至此连接数据库完毕

  string str_Sql = "SELECT * FROM [main] WHERE ID=";
  string l = str_Sql + index.ToString();
  OleDbCommand command = new OleDbCommand(l, objConnection);
  OleDbDataReader reader = command.ExecuteReader();

  while (reader.Read())
  {
  for (int n = 0; n <= 3; n++)
  {
   
  }
  } 
就是循环中该怎样写?

------解决方案--------------------
while (reader.Read())
{
for (int n = 1; n <= 4; n++)
{
Console.Write(reader[n]+" ");
}
Console.WriteLine();
}
------解决方案--------------------
http://blog.csdn.net/kkkkkxiaofei/article/details/7755223
参考资料