Asp.net| Design Abstract "The website News management system developed by using ASP.net and ado.net technology has realized the dynamic management of the website news, which makes the management of information more timely and efficient, and improves the work efficiency." At the same time, the system development principle, the system function characteristic and the design plan are introduced.
"Key Words" asp.net ado.net news Management database
With the popularization of the Internet, more and more enterprises set up their own WWW website, the enterprise can display products through the website, release the latest dynamic, communicate with the users, establish contact with the partners, and carry out e-commerce. The news management system is an important part of the enterprise Web site, it bears the double function, on the one hand can be used to dynamically release the relevant new products or new development projects, on the other hand, can timely announce the business performance, technology and research and development progress, special recommendation or preferential projects, products and services, In order to attract customers, expand customer base.
Traditional website News management method has two kinds, one is the static HTML page, the update information needs to re-create the page and then uploads the page and modifies the corresponding link, this way because the efficiency is too low has not much use. The second is based on ASP and scripting language, the combination of dynamic Web pages and databases, through the application of the processing of news, this is a more popular practice. However, due to the limitations of the ASP itself makes the system some insurmountable defects, and adopted the ASP.net technology of the systematic performance has been greatly improved, its main performance in the following areas:
1. Since the ASP page must be compiled and interpreted every time it is opened, the page does not have any elevation when it is repeatedly opened, and the ASP.net page needs to be compiled only once without recompiling until the page is modified or the Web application restarts. This allows for a significant increase in the speed of multiple accesses.
2. Because the ASP does not provide any components that output data as content, you can only use the ADO Recordset object to read records on a per-pen basis when you compose a database page using ASP, while ASP.net database components, such as the DataGrid provided by Ado.net, directly relate to the database.
3. Asp. NET supports real-time updates of applications. An administrator can update the application file without shutting down the network server or even stopping the application from running. Application files are never locked, so files can be overwritten even while the program is running. When the file is updated, the system is gently converted to the new version.
4. Asp. NET takes "Code-behind" way to write code makes code easier to write, structure clearer, reduce the complexity and cost of system development and maintenance.
The development principle of 1 system
1.1 System structure model based on ASP.net technology
Asp. NET structure is a three-tier system: The UI layer, the business logic layer, and the data tier, as shown in Figure 1.
Figure 1 ASP. System Structure Model of net
The UI layer is responsible for interacting with the user, receiving input from the user and presenting the server-side data to the customer.
The business logic layer is responsible for receiving requests from the browser and passing the request to the data tier while sending the request processing results to the browser. It consists of Web Forms, XML Web services, and Component Services. The Web form is the core of the ASP.net application, which is the basis for presenting data and information to customers and is the basis for responding to and handling the information and data generated by the interaction between the customer and the displayed Web form.
The data layer provides data services for the transaction logic layer through ado.net manipulating data, such as storing data operation results, returning data retrieval results, etc.
1.2 ADO. NET access to the database principle
Connected to the database, ADO. NET provides 3 ways to connect through ODBC, connect via OLE DB, and connect directly to SQL Server. 3 ways because of the difference of application level, the efficiency from low to high, independence from high to low. There are 2 ways of data processing for connected databases, one is to isolate heterogeneous data sources through a dataset, and the other is to read from the data source in a streaming manner (DataReader way).
Traditional applications are designed by first establishing a connection to the database and maintaining the connection during the entire run of the program. Asp. NET takes a disconnected way of data structure. When a browser requests a Web page from a Web server, the server processes the request and sends the requested page to the browser, and the connection is disconnected until the browser makes the next request.
Ado. NET, another innovation is the introduction of Datasets (DataSet). A dataset is a high-speed buffer in memory that provides a data graph. Datasets are ignorant of data sources and can be generated and populated by programs or by the transfer of data from the Data warehouse. Regardless of where the data is obtained, the dataset is manipulated by using the same program template, and it uses the same potential data buffer.
2 function design of the system
2.1 Functional structure of the system
The news management system can be run on the Windows Server operating system platform, the Web server is IIS, the database server is Microsoft SQL Server2000, and Microsoft Visual Studio is used by development tools. NET and Dreamweaver. Fig. 2 shows the functional structure diagram of the system. Its workflow is: User login through the right to judge, ordinary users can only browse, read and query news, registered users in addition to the ordinary user can complete the operation, but also access to news management module for news entry, modify and delete the operation. Registered users except the system administrator can only for their own entry of the news to be censored operation.
2.2 Functional characteristics of the system
(1) Simple operation, user-friendly interface: Complete control of the page layout, making the entry of news more convenient; many options include news categories, source departments, and so on, with only a click of the mouse, and the tracking of the prompts to keep users aware of their actions.
(2) Instant visible: The processing of news (including input, modification, delete) will immediately in the home page corresponding column display, to achieve "instant release, Instant effect" function.
Fig. 2 System Functional Structure diagram
(3) Functional improvement: including the common web site of all aspects of news management: News entry, browse, delete, modify, search and other aspects, the complete realization of the site on the real-time news management requirements.
(4) Easy to transplant: for different enterprises, only a slight modification can be developed for the enterprise characteristics of the website news management System!
3 detailed design of the system
The main function of the system is to realize it through several function modules. The specific design process is as follows:
⑴ System Login: This module is responsible for the user divided into ordinary users and registered users to achieve user Rights management.
⑵ News Browsing: This module is responsible for the paging list of all news information, including the title, type, source department field and release date, each news title is made a hyperlink, click on them can jump to the page for news reading.
⑶ News reading: Click on the title link in other pages to enter the news reading page, at this point, the details of each news will be taken out, including content, title, keywords, etc., and in a relatively fixed format placed in different areas of the page, all the news using roughly the same page layout, but the corresponding content of each field is different, In addition, other locations on the page, you can dynamically place other components, such as website logo logo, page ads, such as banner link pictures, so you can easily realize the reading effect of illustrations.
⑷ News Query: This module provides a news query function, input the content to be looked for and select the classification information can quickly find the match condition news, and output the query result.
⑸ News Management: This module is responsible for the paging list of registered users have published and not deleted news information, users can delete the news, modify. Non-news publishers do not have the ability to process the news in addition to the system administrator, so different users will display different content when they enter this page.
⑹ News Entry and modification: Registered user input a news required content, including title, keyword, type, source department, release date, etc., and from the login module to get the user name, this information will be written to the database to save. The module is also responsible for updating the edit state, where it initializes the page control based on the value of the title field obtained.
The following is an example of the main events and functions of the system login page, which illustrates the development process of the system.
Isreguserok function: Determines whether the user is registered and the password is correct
public bool Isreguserok ()
{
String Name=textboxname.text.trim ();
String Pwd=textboxpassword.text.trim ();
Establish/Open a database connection
SqlConnection conn=new SqlConnection ();
Conn. Connectionstring= "server= (local); uid=sa;pwd=;d atabase=jxdb";
Conn. Open ();
Build SQL string
String Sql= "select * from Reg where name= '" +name+ "";
SqlDataReader Dr;
SqlCommand cmd=new SqlCommand (sql,conn);
Dr=cmd. ExecuteReader ();
Keep user registration or not information
BOOL Isreguserexist=dr. Read ();
Close DataReader
Dr. Close ();
Get password for user name
String Sqlboth= "select * from Reg where name= '" +name+ "";
sqlboth+= "and pwd= '" +pwd+ "";
SqlCommand cmdboth=new SqlCommand (sqlboth,conn);
SqlDataReader Drboth;
Drboth=cmdboth.executereader ();
Keep user name + password exist at the same time information
BOOL Isbothexist=drboth.read ();
Close DataReader
Drboth.close ();
Conn. Close ();
Determine if a user is registered
if (!isreguserexist)
{
Response.Write (' <script>alert (' This user has not yet registered! ')");
return false;
}
Determine if the user name and password are consistent
else if (!isbothexist)
{
Response.Write ("<script>alert" (' Username and password inconsistent, cannot enter!) ')");
return false;
}
Else
return true;
}
Finally, the system back-end data storage scheme is given:
Build a database and its stored procedures with Microsoft SQL Server 2000. Here are two required data tables, one of which is the data table news contains the fields: number, name, title, keyword, content, type, source department, and date. The field description is as follows:
The second is that the data table Reg contains the following fields: number, name, password, department, email, and phone. The field description is as follows:
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.