111,044
社区成员
发帖
与我相关
我的任务
分享
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...