数据库的语法问题.

来源:百度知道 编辑:UC知道 时间:2024/06/14 16:26:25
if (!IsPostBack)
{
string strConnnection = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=";
strConnnection += Server.MapPath(".\\App_Data\\news.mdb");

OleDbConnection myconn = new OleDbConnection(strConnnection);
OleDbDataAdapter mycmd = new OleDbDataAdapter("select id ,typename from types", myconn);

DataSet ds = new DataSet();
mycmd.Fill(ds, "types");
this.DropDownList1.DataSource = ds.Tables["types"].DefaultView;
}

谁能帮我解释一下这什么意思啊 能详细点最好~

if (!IsPostBack)
{
string strConnnection = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=";
strConnnection += Server.MapPath(".\\App_Data\\news.mdb");
\\定义连接字符串

OleDbConnection myconn = new OleDbConnection(strConnnection);
\\定义数据库连接,使用刚定义的哪个连接字符串

OleDbDataAdapter mycmd = new OleDbDataAdapter("select id ,typename from types", myconn);
\\定义数据适配器,并申明SQL语句,数据库连接使用刚定义的连接
DataSet ds = new DataSet(); \\定义数据集
mycmd.Fill(ds, "types"); \\填充数据集
this.DropDownList1.DataSource = ds.Tables
\\填充下拉框内容
["types"].DefaultView;
}

什么语言的?

连接数据库 将数据列表邦定在DropDownList上

啥意思?