Asp.net| data because it is in the design of a asp.net+xml+delphi three-layer design
So do a little finishing on a simple thing.
The following is an access to xml,access,mssql data
Protected DataSet Loadmypbdata ()
{
String sourcexml = Server.MapPath ("Phone.xml");
DataSet DataSet = new DataSet ();
Try
{
DataSet.ReadXML (SourceXML);
}
catch (Exception e)
{
DataSet = null;
}
return dataSet;
}
void Page_Load (object sender, EventArgs e)
{
if (!) ( Page.IsPostBack))
{
Gridv. DataSource = Loadmypbdata ();
Gridv. DataBind ();
}
}
-------------------------------
String strsql= "Data source=127.0.0.1;initial catalog=dotnet;persist security Info=true;user id=sa;password=1234; Packet size=4096 ";
SqlConnection myconn = new SqlConnection (strSQL);
MyConn.Open ();
String commsql = "SELECT * from Gbook ORDER by id DESC";
SqlDataAdapter ADP = new SqlDataAdapter (Commsql,myconn);
DataSet ds = new DataSet ();
Adp. Fill (DS);
DataGrid1.DataSource = ds;
Datagrid1.databind ();
Myconn.close ();
---------------------------------------
if (! IsPostBack)
{
OleDbConnection myconnection =new OleDbConnection ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +Server.MapPath (" New.mdb "));
OleDbDataAdapter mycommand=new OleDbDataAdapter ("Select Id,typename from BB", MyConnection);
DataSet ds= new DataSet ();
Mycommand.fill (ds, "BB");
Dropdownlist2.datasource = ds. tables["BB"]. DefaultView;
Dropdownlist2.datatextfield = "TypeName";
Dropdownlist2.datavaluefield = "id";
Dropdownlist2.databind ();