asp.net C#与access连接的小问题
请问我是用 C#与access连接的,一定要用accessdatasource这个级件吗,用的是repeater这个组件显示数据的,下面是连接代码:
protected void Page_Load(object sender, EventArgs e)
{
OleDbConnection sqlcon;
string strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data source=" + Server.MapPath("vs.mdb");
sqlcon = new OleDbConnection(strCon);
string sqlstr = "select * from newl";
OleDbDataAdapter myda = new OleDbDataAdapter(sqlstr, sqlcon);
// OleDbDataAdapter
DataSet myds = new DataSet();
sqlcon.Open();
myda.Fill(myds);
Repeater1.DataSource = myds;
Repeater1.DataBind();
sqlcon.Close();
}