Data | database four. Inserting data records: </P><P> Insert record operations and delete records operations on a database The basic idea is to use ado.net to insert data into the database first, and then make the necessary modifications to the DataSet object. The following code is the code that modifies the current record in an Access 2000 database model: </p><p>protected void Update_record (object sender, System.EventArgs e)
{
MessageBox.Show ("Modify the specified record error:" + ed.) ToString (), "Error!" " ) ;
}
Mybind.position = i;
} </P><P> because the difference between the SQL Server 2000 data Logging modification operation and the Access 2000 data record modification operation is only in different data links, the specific code can refer to the code in the "Delete data record", which is not available here.
Five Insert Data record:
In line with the previous two operations, the idea is to first insert data into the database through ado.net, and then make the necessary modifications to the DataSet object. The following code is the code that inserts a data record for the model in an Access 2000 database
MessageBox.Show ("All field values must be filled!") "," the mistake! " ) ;
}
}
catch (Exception ed)
{
MessageBox.Show ("Save data Record Occurrence" + ed.) ToString (), "Error!" " ) ;
}
}
Also, the difference between an Insert record operation for a SQL Server 2000 database and an Access 2000 database insert record is only a different data link, and the code can refer to the code in the "Delete data record", which is not available here.
Six Visual C # Database programming completes the main interface of source code and program running:
With the above points in hand, it's easy to write a complete database programming program, followed by the complete code for database programming in Visual C # (Data01.cs), designed in an Access 2000 database model, as follows:
String Strcon = "Provider = sqloledb.1;" Persist security Info = False; User ID = sa; Initial Catalog = data1; Data Source = Server1 ";
Note: This data link means: Open the SQL Server database, the server name is Server1, the database is Data1
You can get the complete source code that Visual C # has programmed for the SQL Server 2000 database for templates. So this article is no longer available.
Seven Summarize:
Database programming is always a key and difficult point in program programming content. These operations are the most basic and important content of database programming. Those complex programming is nothing more than a number of these processes superimposed.
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.