Getting Started with ADO

Source: Internet
Author: User

            1.0 connection Strings String constr = "Data source=.;i Nitial catalog=test; User Id=sa;            password= ' Qwertyu ' ";  2.0 returns the first column of the row results using (SqlConnection conn = new SqlConnection (constr)) {string sqlstr                = @ "SELECT count (1) from sys_users where deleteflag = 0"; Conn.                Open ();                SqlCommand command = new SqlCommand (SQLSTR, conn); int result = Convert.ToInt32 (command.            ExecuteScalar ());                }//3.0 returns the first column of the row results using (SqlConnection conn = new SqlConnection (constr)) {                String sqlstr = @ "INSERT into sys_users (id,name,age) VALUES (12334EFDGDFG ', 13)";                String sqlstr = @ "INSERT into sys_users values (12334EFDGDFG ', 13,0)"; Update sys_users set name= ' PPPPPPPPPP ' where id=1 Conn.                Open ();                SqlCommand command = new SqlCommand (SQLSTR, conn); int result = Convert.ToInt32 (command. ExecUtenonquery ()); }//4.0 Returns the result set SqlDataAdapter da = new SqlDataAdapter ("select name from Sys_users where deleteflag=0;            Select age from Sys_users where deleteflag=0 ", constr);            DataSet ds = new DataSet (); Da. Fill (DS);

  

Getting Started with ADO

Related Article

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.