Close access to ASP. Net (8)

Source: Internet
Author: User

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)

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.