• Access插入数据


    private static void AddToDB(IEnumerable<HotelInfo> list)
            {
                OleDbConnection conn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\dbxc.mdb");
                OleDbTransaction trans;
                conn.Open();
    
                trans = conn.BeginTransaction();
                OleDbCommand cmd = conn.CreateCommand();
                cmd.Transaction = trans;
                foreach (HotelInfo info in list)
                {
                    cmd.CommandText = "insert into hotelinfo(url,标题,简介,周围环境,地区查询,开业时间,酒店地址,房间数量,价格信息) values('" + info.url + "','" + info.标题 + "','" + info.简介 + "','" + info.周围环境 + "','" + info.地区查询 + "','" + info.开业时间 + "','" + info.酒店地址 + "','" + info.房间数量 + "','" + info.价格信息 + "')";
                    cmd.ExecuteNonQuery();
                }
                trans.Commit();
                cmd.Dispose();
                trans.Dispose();
            }
  • 相关阅读:
    大数减法
    MySQL配置的一些坑
    最大流_Edmonds-Karp算法
    最小生成树两连
    最短路三连
    对拍
    Broadcast
    Intent
    Custom Views
    Fragment
  • 原文地址:https://www.cnblogs.com/i80386/p/2253146.html
Copyright © 2020-2023  润新知