asp.net高手救急!!!
DataList控件如何绑定access数据库呀?最好发段代码给我参考参考叭!!!!
补充:大哥们呀..咋还是显示不出数据呢?
补充:大哥们呀..咋还是显示不出数据呢?
答案:using System.Data;
using System.Data.OleDb;
string strConnection="Provider=Microsoft.Jet.OleDb.4.0;";
strConnection+=@"Data Source=C:BegASPNETNorthwind.mdb";
OleDbConnection objConnection=new OleDbConnection(strConnection);
..
objConnection.Open();
//引用上面的朋友一点代码,,.
DataAdapter.SelectCommand.CommandText = "sql 语句";
DataSet result = new DataSet();
DataAdapter.Fill(result);
DataList.DataSource=result ;
DataList.DataBind();
objConnection.Close();啊
OleDbConnection conn = new OleDbConnection("链接字符串");
OleDbDataAdapter DataAdapter = new OleDbDataAdapter();
DataAdapter.SelectCommand = new OleDbCommand();
DataAdapter.SelectCommand.CommandText = "sql 语句";
DataSet result = new DataSet();
DataAdapter.Fill(result);
DataList.DataSource=result ;
DataList.DataBind();ssds如果是vs2003就要用:
DataList.DataSource=result.Tables[0].defaultview;
DataList.DataBind();
上一个:asp.net关于Treeview
下一个:ASP判断表是否存在