C# ACCESS 插入数据

using System.Data.OleDb;
    private void 插入VIN号(string str)
        {
            //创建连接对象
            OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:/姜民强-油箱盖标签自动分拣/条形码数据.mdb;Persist Security Info=False");
            conn.Open();
            // string 数据1 = "AABB";
            string sql;
            sql = "insert into 条形码表 (条形码) values('";
            sql = sql + str + "')";

            OleDbCommand cm = new OleDbCommand(sql, conn);
            cm.ExecuteNonQuery();
            conn.Close();
            //richTextBox1.Text = DateTime.Now.ToLongTimeString() + "保存车号为:" + str + "\r\n" + richTextBox1.Text;
        }
    

你可能感兴趣的:(access)