Use of Namespace
In the previous program, we can see that I often use <% @ Import Namespace = "System. Data" %>.
Use the Namespace provided by M $ for us. This is different from ASP. We must first reference the Namespace provided by our operations in ASP.net.
The corresponding functions can be used only after the Namespace is disabled. To put it bluntly, a Namespace is a component.
This is an advanced application of ASP.net. I will talk about it in a later chapter. (But write it there, time ......
)
Below I will briefly list some commonly used namespaces
<% @ Import Namespace = "System. Data" %> used to process Data
<% @ Import Namespace = "System. Data. ADO" %> used when using ADO.net;
<% @ Import Namespace = "System. Data. SQL" %> dedicated to SQL Server databases
<% @ Import Namespace = "System. Data. XML" %> you do not need to view
<% @ Import Namespace = "System. IO" %> used for File Processing
<% @ Import Namespace = "System. Web. Util" %>
<% @ Import Namespace = "System. Text" %> used for Text Encoding
What database operations require
After explaining the Namespace, we can officially discuss database applications. From the above we can see that we operate
Database, We need to reference the following two namespaces
<% @ Import Namespace = "System. Data" %>
<% @ Import Namespace = "System. Data. SQL" %>
In fact, System. Data. SQL can be replaced by System. Data. ADO. SQL is dedicated to SQL Server and ADO can
Support any database (as long as there is a corresponding driver on the host, such as Access, Mysql, Oracle, and so on)
Because the Apsara stack database is SQL Server, you can use ADO.
Come on, why not. As for the benefits it can bring, the flying knife has not been tested, and the SQL Server must be better than the ADO
Better.
Both ADO and SQL have several basic objects for operations.
Connections is linked to a database to facilitate subsequent applications (similar to Connections in ADO)