When using Asp.net for a project, first create the Asp.net project, and then use the Enterprise Library Configuration tool to directly open web. config. Then fill in the relevant parameters. For more information about parameter settings, see configure.
Code:
Using system;
Using system. collections;
Using system. componentmodel;
Using system. Data;
Using system. drawing;
Using system. Web;
Using system. Web. sessionstate;
Using system. Web. UI;
Using system. Web. UI. webcontrols;
Using system. Web. UI. htmlcontrols;
Using system. xml;
Using Microsoft. Practices. enterpriselibrary. Data;
Using Microsoft. Practices. enterpriselibrary. Data. SQL;
Namespace thyx
{
/// <Summary>
/// Summary of webform1.
/// </Summary>
Public class webform1: system. Web. UI. Page
{
Protected system. Web. UI. webcontrols. DataGrid datagrid1;
Protected system. Web. UI. webcontrols. textbox textbox2;
Protected system. Web. UI. webcontrols. Label label1;
Protected system. Web. UI. webcontrols. Label label2;
Protected system. Web. UI. webcontrols. Button button1;
Private void page_load (Object sender, system. eventargs E)
{
If (! Ispostback)
{
// Gettabs ();
}
}
# Code generated by region web Form Designer
Override protected void oninit (eventargs E)
{
//
// Codegen: This call is required by the ASP. NET web form designer.
//
Initializecomponent ();
Base. oninit (E );
}
/// <Summary>
/// The designer supports the required methods-do not use the code editor to modify
/// Content of this method.
/// </Summary>
Private void initializecomponent ()
{
This. button1.click + = new system. eventhandler (this. button#click );
This. Load + = new system. eventhandler (this. page_load );
}
# Endregion
Private void button#click (Object sender, system. eventargs E)
{
Gettabs ();
}
Public void gettabs ()
{
Database DB = databasefactory. createdatabase (); // call the database connection
String sqlcommand = "gettab"; // Stored Procedure
Dbcommandwrapper = dB. getstoredproccommandwrapper (sqlcommand );
Dataset productsdataset = NULL;
Productsdataset = dB. executedataset (dbcommandwrapper );
Datagrid1.datasource = productsdataset. Tables [0]. defaultview;
Datagrid1.databind ();
}
}
}
I'm afraid I forget it, so remember it here.