日期:2014-05-18 浏览次数:21083 次
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Data.SqlClient; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace newbook { public partial class Frm_publish : Form { public Frm_publish() { InitializeComponent(); } SqlDataAdapter ADP = null; DataSet ds = new DataSet(); private static string selectComm = "select a.pid,a.pub_id,a.pub_name,b.area_name as areaid,a.address from j_publishing a,j_area b where a.areaid=b.area_id"; SqlDataAdapter ADP_combox = null; //DataSet ds_combox = new DataSet(); private static string combox = "select area_id,area_name from j_area"; private void Frm_publish_Load(object sender, EventArgs e) { try { ADP = new SqlDataAdapter(selectComm, operation.conn()); ADP.Fill(ds, "publish"); this.dataGridView1.DataSource = ds.Tables["publish"]; ADP_combox = new SqlDataAdapter(combox, operation.conn()); ADP_combox.Fill(ds, "combox"); this.Column5.DataSource = ds.Tables["combox"]; this.Column5.DisplayMember = "area_id"; this.Column5.ValueMember = "area_name"; } catch (DataException se) { MessageBox.Show(se.ToString()); } } } }