Esempio n. 1
0
        public void TestInsert()
        {
            string sql = @"INSERT INTO [PersonInfo$](姓名, 籍贯)
                            VALUES(@Name, @Home)";

            OleDbParameter[] para =
            {
                new OleDbParameter("@Name", "王五"),
                new OleDbParameter("@Home", "绵阳")
            };

            try
            {
                int result = ExcelDBHelper.ExecuteCommand(sql, para);
            }
            catch (Exception ex)
            {
                string str = ex.ToString();
            }
            finally
            {
            }
        }
Esempio n. 2
0
 public void TestMethod1()
 {
     //
     // TODO: 在此	添加测试逻辑
     //
     try
     {
         string  sql = "select * from [PersonInfo$]";
         DataSet ds  = ExcelDBHelper.GetReader(sql);
         if (ds != null && ds.Tables.Count > 0)
         {
             List <string> list = new List <string>();
             foreach (DataRow dr in ds.Tables[0].Rows)
             {
                 string str = dr[0].ToString() + dr[1].ToString();
                 list.Add(str);
             }
         }
     }
     catch (Exception ex)
     {
         string str = ex.ToString();
     }
 }