110,825
社区成员
![](https://csdnimg.cn/release/cmsfe/public/img/topic.427195d5.png)
![](https://csdnimg.cn/release/cmsfe/public/img/me.40a70ab0.png)
![](https://csdnimg.cn/release/cmsfe/public/img/task.87b52881.png)
![](https://csdnimg.cn/release/cmsfe/public/img/share-circle.3e0b7822.png)
using System;
using System.Data.OleDb;
using System.Data;
namespace zzzDemo
{
/// <summary>
/// ConnDAO 的摘要说明。
/// </summary>
public class ConnDAO
{
private OleDbConnection oConn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=../../OrderSystem.mdb");
private OleDbDataAdapter oda = null;
private DataTable dt = new DataTable("Order_Product");
private DataTable dt1 = new DataTable("Dictionary");
public ConnDAO()
{
oConn.Open();
oda = new OleDbDataAdapter("select * from Dictionary",oConn);
oda.Fill(dt);
oConn.Close();
}
public DataTable GetDictionary()
{
return ds.Tables["Dictionary"];
}
public bool addDictionary(Dictionary dy)
{
DataTable dt = this.GetDictionary();
DataRow dr = dt.NewRow();
dr["Category"] = dy.Category;
dr["Value"] = dy.Value;
dt.Rows.Add(dr);
int i = oda.Update(ds,"Dictionary"); //调试到这一步就不走了....
if(i>0)
return true;
else
return false;
}
}
public class Dictionary
{
private string _Category;
private string _Value;
public string Category
{
get{return _Category;}
set{_Category = value;}
}
public string Value
{
get{return _Value;}
set{_Value = value;}
}
}
}
oda.Fill(dt1); //填充为dt1...