In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the relevant knowledge of "what are the attributes of ADO.NET". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
The ADO.NET property is used to connect to the database, execute the SQL statement through the ADO.NET object, return the result to DataReader or DataAdapter, and then manipulate the data result using the obtained DataReader or Adapter object.
The code to create the Connection object:
OLEDB: OleDbConnection MyConnection=new OleDbConnection ()
SQL: SqlConnection MyConnection=new SqlConnection ()
◆ their ConnectionStringADO.NET property: gets or sets the connection statement. MyConnection.ConnectionString= "server= (local); database=pubs;uid=sa;pwd=''"
◆ DataBase property: gets the currently open database
◆ DataSource property: gets the connection instance that opens the database
◆ Open method: open a connection
◆ Close method: close the connection
6.2.2 Command and DataReader objects
The Command object contains access information for submitting the database system. OleDbCommand is the same as SqlCommand object, and the basic object and operation method of ADO.NET property are the same. Here we introduce the usage of OleDbCommand and analogy of the usage of SqlCommand.
For example: OleDbCommand myComm = new OleDbCommand (strQuery,myConnection)
* the parameter is a sql statement or stored procedure name, and the second parameter is an instance of the previous Connection object
The only ADO.NET properties and methods of the Command object are:
◆ Connection property: sets or gets the Connection object instance used by the Command object
◆ CommandText property: sets or gets the name of the sql statement or stored procedure to be executed
◆ CommandType property: sets or gets the type of statement executed. It has three attribute values: StoredProceduce (stored procedure) TableDirect Text (standard SQL statement) defaults to Text
◆ Parameters property: gets a collection of parameter values
EReader method: executes the SQL statement or stored procedure name specified by CommandText, and the return type is DataReader
◆ ExecuteNonQuery method: the same function as ExecuteReader, except that the return value is the number of rows of records affected by the execution of sql statements or stored procedures
The main ADO.NET properties and methods of DataReader are:
◆ FieldCount property: displays the sum of fields for the current data record
◆ IsClosed property: determines whether the DataReader object has been closed
◆ Close method: closes the DataReader object
◆ GetString method: returns the value in the specified column as a String type
◆ Getvalue method: returns the value in the specified column as its own type
◆ Getvalues method: returns a collection of all fields of the current record
◆ Read method: point the cursor to the next record of the DataReader object
This is the end of the content of "what are the ADO.NET attributes"? thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.