private void SubmitBtn_Click(Object sender, EventArgs e)
{
OleDbConnection myConnection;
OleDbDataAdapter myCommand;
string strConnect;
string strCommand;
DataSet ds=new DataSet();
strConnect=@"Provider=Microsoft.Jet.OLEDB.4.0;";
strConnect+=@"Data Source=F:/LOVE/ASP/student.mdb;";
strConnect+="Persist Security Info=false";
strCommand="SELECT * FROM tblstudents";
myConnection=new OleDbConnection(strConnect);
myCommand=new OleDbDataAdapter(strCommand,myConnection);
myCommand.Fill(ds,"tblstudents");
DataGrid1.DataSource=ds.Tables["tblstudents"].DefaultView;
DataGrid1.DataBind();
}
</script>
asp.net连接数据库
最新推荐文章于 2024-11-05 14:22:47 发布