Intimate contact asp.net (8)

Source: Internet
Author: User
Our previous chapters describe how to display information in a database and the basic usage of DataReader and datasets.
Have a friend say not enjoyable, want me to write the following chapter quickly, very sorry, I really do not have much time, write this
Some are very slow. (Don't throw eggs, at most I don't talk nonsense)
Let's talk about DataSet here, this is a powerful stuff, we have a in the last section
Preliminary understanding, here we want to talk about it if used to manipulate the data. is also very simple dongdong, but the function is formidable, must
It's not possible, because the dataset and DataGrid controls account for more than 50% of. Net Help, and this
A total of 23M ...
Here we set up a Test.mdb database as a test database, with a table named ASPCN, with a number
According to the structure as shown
Figure 8-1
A database operation without a dataset
Before we use the dataset, let's take a look at how to insert a database without using a dataset in asp.net.
Update, delete.
To insert, UPDATE, delete data without using a dataset, there is no way, only SQL directly come:
, I'll just talk about how to insert, because the other operation is only to change the SQL statement, I think we have no problem
it. Because of the use of the MDB database, this will be done with ado.net.
Let's look at the whole source code first.
<% @ 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/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.