1. Learn the points of knowledge:
Database operation Syntax:
SqlConnection Database Connection Object
SqlConnection con =new SqlConnection ();
Con.open ();//Open database
SqlCommand Database Operations Command
SQlCommand com =new SQlCommand ();
com.commandtype=com.commandtext;//operation type is a database SQL statement
com.commandtext= "SELECT * from TB";//SQL statement executed
Com. Parameters.Add ("@id", SqlDbType.Int);//define an input parameter @id the search value for the SQL statement such as: SELECT * from TB where [email protected] SqlDbType. Int defines the field type
Com. ExecuteReader ();//Execute DATABASE statement.
Sqldataadapater//To populate the dataset and update the database commands
Sqldataadapater adapater =new sqldataadapater ("SELECT * from TB", con);//Execute DATABASE statement, return a stream
DataSet _ds=new DataSet ();
Adapater. Fill (_ds);//Data fills into a dataset or
Adapater=com. ExecuteReader ();
Whlie (Adapater. Read ())//Adapater. Read () indicates that the forward view record is equivalent to _ds. Table[0]. rows[i]["id"].tostring ()
{
}
Adapater. Dispose ();//Release resources
Con. Close ();//Closing database connection
TreeView Knowledge Point
TreeNode tr=new TreeNode ("all");//define a tree node
Tr. Nodes.Add ("Level Two Node");
Tr. Nodes[index]. Nodes.Add ("")//index the location of the Add node
Treeview. The Checkboxs=true;//property check box displays
Treeview. imagelist=imagelist1;//Add picture Display imagelist1 is a picture control on the toolbar
Treeview. Expanall ();//Expand All nodes
C # operations TreeView, Database read data (2017-12-12 learning Note)