The previous chapter describes how to display information in the database and the basic usage of DataReader and DataSet,
Some friends say they are not addicted. I want to write down the following chapters quickly. I am very sorry. I really don't have much time to write this article.
Slow. (Don't throw eggs. I will not talk nonsense at most)
Let's talk about DataSet here. This is a powerful feature. We have
For a preliminary understanding, here we will talk about how to operate data. It is also very simple, but it is powerful and requires
It is unlikely that the description of DataSet and DataGrid controls accounts for more than 50% of. Net Help.
A total of 23 m...
Here we create a test. mdb database as the test database, where there is a table named aspcn, number
Data Structure
Figure 8-1
Database Operations without DataSet
Before talking about the application of DataSet, let's look at how ASP.net inserts a database without using DataSet,
Update, delete.
Data needs to be inserted, updated, and deleted, but DataSet cannot be used. There is no way to do this. You only need to use SQL to directly access the data :)
Here, I will only talk about how to insert, because other operations are just to change the SQL statement. I think there is no problem.
Right. Because the mdb database is used here, we need to use ADO.net for this operation.
Let's take a look at the entire source code.
<% @ Page Language = "C #" %>
<% @ Import Namespace = "System. Data" %>
<% @ Import Namespace = "System. Data. ADO" %>
<Script Language = "C #" Runat = "Server">
Public string myConnstring = "Driver = {Microsoft Access Driver (*. mdb )};
DBQ = c:/test. mdb ;";
ADOConnection MyConnection;
Public void Page_Load (Object src, EventArgs e)
{
// User submits data
}
Public void submit_Click (Object src, EventArgs e)
{
String username1 = Request. Form ["username"];
String address1 = Request. Form ["address"];
String school1 = Request. Form ["shool"];
String strInsert = "insert into aspcn (username, address, school)