Ado. NET Query and Operations database

Source: Internet
Author: User

StringBuilder class

StringBuilder class: Used to define variable strings

Stringbulider Append (string value) appended at the end

StringBuilder Insert (int index,string value) inserts the specified string at the specified position

StringBuilder remove (int strtindex,int length) Remove the pointing string


StringBuilder sbtest = new StringBuilder ();
Instantiate a string builder object first
Sbtest. Append ("Hello");
Sbtest. Append ("World");
Console.writerline (sbtest.  Ststring ()); Turn into String type
Console.ReadLine ();

Using the String builder class will save more memory space
Using the StringBuilder class makes SQL statements more readable


Datereader Object
Retrieving read-only, forward-only data streams from the data source
Reads one row of data at a time

System.date.sqlclient SqlData Reader

System.date.oledd Oledddatareader

SYSTEM.DATA.OBDC OdbcDataReader

System.Data.OracleClient OracleDataReader

Key members of the DataReader
Property Description
HasRows whether the result is returned
Method description
Read forward to the next line of records
Close closes the DataReader object

Retrieving data steps using Datereader
To create a Command object
Call ExecuteReader () to create the DataReader object
Read data line by row using the Read () method of the DataReader object
Reads the data for a column (type) reader["column name"]

exec cutenonquery () method

SQL additions and deletions modified by this method
Returns the number of rows affected
Steps to use ExecuteNonQuery ()
1 Creating a Connection object
2 Defining SQL statements
3 Creating a Command object
4 Execute ExecuteNonQuery () method
5 processing based on the returned results


Ado. NET Query and Operations database

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.