数据库与C#的连接
我写好了一个查询的代码,也建好了一个数据库,可是我怎么才能让我写的代码访问到数据库呢?
怎么连接数据库跟C#语句呢?
string sql = "";
private static DataBase db=new DataBase();
private static DataTable dt = new DataTable();
private void btn_select_click(object sender, EventArgs e)
{
try
{
GridBind();
}
catch
{
}
}
private void GridBind()
{
sql = "select*from Mark";
dt = db.ExecuteSQL(sql);
Data_GrivdView.DataSource = dt;
}
------解决方案--------------------参考,简单的操作,自己看看ADO.NET
http://topic.csdn.net/u/20100118/20/abc06516-c295-49c7-aa92-a0571384c19c.html
------解决方案--------------------http://download.csdn.net/detail/xianfajushi/4282042
http://download.csdn.net/detail/xianfajushi/4028787