Datalist is more flexible than DataGrid in displaying data (or in vs2003). It should provide several templates for datalist, while some custom user controls can be flexibly placed in the template. The specific implementation is as follows:
Create a user control first:
Author No.: Author name:
Background code:
Private string au_id;Public String au_id{Set{Au_id = value;}Get{Return au_id;}}Protected void page_load (Object sender, eventargs E){If (! Ispostback){This. BIND ();}}Private void BIND (){
I. Basic operations with sqlserverThe connection character is written in the configuration file in this way.[Html]The basic operation class is as follows:[Csharp]Public class SQLHelper{Private SqlConnection sqlCon = null;Private SqlCommand cmd = null;Private SqlDataReader sdr = null;Public SQLHelper (){SqlCon = new SqlConnection (ConfigurationManager. ConnectionStrings ["ConnStr"]. ConnectionString );}/// /// Open the database connection/// /// Privat
); SqlDataReader SDR = cmd. ExecuteReader (); Dt. Load (SDR); Close the SDR. Close (); Conn. Close (); return to DT; } As you can see from the code above, you'll need to add a connection-open-close three-step code for each specific operation, and then we can encapsulate it a
obtained from the adapter;Close ();Return ds;//to go back to the data stored in the DS}4. Return SqlDataReader data stream via SQL statement///To call SqlCommandpublic static SqlDataReader GETSDR (String strSQL){Open ();SqlCommand com = new SqlCommand (strSQL, conn);Sdr=com. ExecuteReader (system.Data.CommandBehavior.CloseConnection);Return Sdr;s}5. Return DataView via SQL statement????????????????????????
dense, and more power-saving technology improvements.DDR3 's development cannot be said to be a smooth one, although the original standard was released in 2005 and applied to the Intel P35 "Bearlake" chipset in 2007, but it did not replace DDR2 as quickly as the industry had expected. This has also experienced a far-reaching financial crisis on SDRAM industry, not only make the DDR3 occupy the market slower, but also make DDR3 in the technology of the world's leading memory of the giant dream o
Summary of three methods for connecting. net MVC to the local database,. netmvc
. Net MVC connection data local database three methods
Public class HomeController: Controller {// GET:/Home/public ActionResult Index () {# region connect SQL function one SqlConnectionStringBuilder one = new SqlConnectionStringBuilder (); one. dataSource = "(local) \ sqlexpress"; one. initialCatalog = "xsgl1"; one. userID = "sa"; one. password = "a123456"; one. maxPoolSize = 512; SqlConnection sct = new SqlConne
property of the ConfigurationManager classpublic static SqlDataReader Getreader (String sql){SqlConnection conn = new SqlConnection (connstring);SqlCommand cmd = new SqlCommand (SQL, conn);Try{Conn. Open ();return CMD. ExecuteReader (commandbehavior.closeconnection);}catch (Exception ex){Throw ex;}}}Web. config plus node3. Write Entity access classes. The name of the entity Access class is generally the entity class name +service. Concrete action entities, encapsulating entities, returning enti
. Before that, you only need to set the corresponding relationship. There is no doubt that this can solve my needs. It took two days to complete the demo. by reading the information from the configuration file, the corresponding relationship, SQL statement, and target table name were separated, pass in to the function for data import.
The SQL statement and table name are both string, and the corresponding relationship can be stored in a hash table. It is best to store all three attributes in an
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.