《ado.net增删查改小总结_1》由会员分享,可在线阅读,更多相关《ado.net增删查改小总结_1(3页珍藏版)》请在金锄头文库上搜索。
1、我真正系统地接触和学习党的基本知识是在这次中级党校的培训班上。通过学习,了解了党的发展历程,对党的性质、宗旨、任务等基本知识有了进一步的了解ADO.NET增删查改小总结三套路-增删改Code1 using System.Data.SqlClient;23 SqlConnection conn = new SqlConnection(xxx);456 string sql = xxx;78 SqlCommand comm = new SqlCommand(sql, conn);910 conn.Open();1112 comm.ExecuteNonQuery();1314 conn.Close(
2、);三套路-查(绑定到DataGridViewCode1 using System.Data.SqlClient;23 SqlConnection conn = new SqlConnection(xxx);45 string sql = xxx;67 SqlDataAdapter da = new SqlDataAdapter(sql, conn);89 DataSet ds = new DataSet();1011 da.Fill(ds);1213 dataGridView1.DataSource = ds.Tables0;1415 /要更新 查询语句要 查询主键列1617 SqlComm
3、andBuilder sd = new SqlCommandBuilder(da);1819 da.Update(ds.Tables0);三套路-查(绑定到ListView)代码using System.Data.SqlClient;SqlConnection conn = new SqlConnection(xxx);string sql = xx;SqlCommand comm = new SqlCommand(sql, conn);conn.Open();SqlDataReader read = comm.ExecuteReader();while (read.Read()ListViewItem lvi = new ListViewItem(readxxx.ToString();lvi.Tag = readid;listView1.Items.Add(lvi);lvi.SubItems.AddRange(new String readxxx.ToString() );read.Close();conn.Close();对党的认识也有了进一步的提高。才真正体会到了中国共产党的伟大、光荣和正确,更感到只有中国共产党是全中国最广大人民利益的忠实代表