引用dll文件 在web.config进行配置 < appSettings > <!-- 连接Sql数据库 <add key="provider" value="SqlProvider"/> <add key="conn" value="server=.;database=Test;uid=sa;pwd=sa"/> --> <!-- 连Access数据库 --> < add key ="provider" value ="OdbcProvider" /> < add key ="conn" value ="Provider=Microsoft.Jet.OleDb.4.0;Data Source=E:wwwTestClassTest.mdb;Persist Security Info=True;" /> </ appSettings > 数据绑定 private void Bind() ... { ICommonAccess com=(ICommonAccess)DataFactory.GetCommonAccess(); DataSet ds=new DataSet(); ds=com.GetDs("select * from userinfo","de"); this.DataGrid1.DataSource=ds; this.DataGrid1.DataBind(); } 增,删,改 private void Button1_Click( object sender, System.EventArgs e) ... { ICommonAccess com=(ICommonAccess)DataFactory.GetCommonAccess(); string str=com.GetExCmd("insert into userinfo(uname,sex) values ('"+this.TextBox2.Text+"','"+this.TextBox3.Text+"')"); Page.RegisterStartupScript("","<script>alert('"+str+"')</script>"); } 用户登陆 private void Button2_Click( object sender, System.EventArgs e) ... { ICommonAccess com=(ICommonAccess)DataFactory.GetCommonAccess(); int i=com.GetSearch("select count(*) from userinfo where uname='"+this.TextBox2.Text+"'"); this.TextBox1.Text=""+i; }