在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
后来终于找到一个解决方法,就是在解决方案资源管理器里找到类文件选择“引用”,然后右击选择“添加引用”,并且从 .net 中找到System.Configuration把它加上去就OK啦
实例:DataGridView显示数据 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using DevExpress.XtraEditors; using System.Data.SqlClient; using System.Configuration; namespace WindowsApplication1 { public partial class XtraForm1 : DevExpress.XtraEditors.XtraForm { public XtraForm1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { string customers = "select * from Customers"; using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["northwind"].ConnectionString)) { DataSet dt = new DataSet(); SqlDataAdapter da = new SqlDataAdapter(customers, con); da.Fill(dt, "Customers"); dataGridView1.AutoGenerateColumns = true; dataGridView1.DataSource = dt; dataGridView1.DataMember = "Customers"; } } } }
|
请发表评论