All from the "C # web application entry classic" 1. ADO.NET architecture ADO.NET does not mean that the actual content - ADO is originally the name of ActiveX Data Obejects, but a technology name. The most common way to access the database is: First connect to the database, then use the SQL statement. There are different COMMAND object methods for different database operations. For example, the executescalar () method returns an object containing the value, and the executeReader () method is used to access the DataReader object of the result set, and EXECUTENONQUERY () returns an integer value to indicate the number of rows affected by the command. Here, the DataReader object is mentioned, which is a quick, read-only, only a connection pointer returns data from the database. After the object is obtained by an ExecuteReader () method, the read () is called if True returns TRUE to use its method to access the data of the current location. The result set contains multiple data lines, usually use the following code to access each line: reader = command.executeReader (); while (read.read ()) {// process current row} and access to the current line included in each The data in the column unit can be accessed using the method under DataReader: (1) getxxx (), used to retrieve the input value. Methods such as getBoolean (), getString () and getInt32 () can receive column indexes in the form of parameters and return the correct value type. Such as response.write (reader.getstring (0)); (where Reader is the DataReader object of the above code, the same below). Of course, sometimes I don't know the index, and know the name, at this time, I can use the getordERDINAL () method of the DataReader object, which is used to receive the name of the column and return to the column: int pos = Reader.GetORDINAL ("categoryID"); 2) The default Item property can directly access the value of the column. The parameter can be an integer index value or a column name of the String type. The return value is an object type, so it needs to be displayed to The data type required: int ID = (int) Reader ["UserID"]; or int ID = (int) Reader [0]; (3) getValues () method can populate the values in the column into an array. This method receives an Object type array and populates it with data in the current row: object [] value = new object [3]; reader.getVALUES (VALUES); you can initialize this array with DataReader's fieldcount properties. . The code just shown indicates that the first three columns of the current row fills this array.