[public frm_Manage() { InitializeComponent(); string ConnectionString = "Data Source=dzjc_2005;user=kk;password=kk;";//寫連接串
public void InsertComShopID(ComboBox cb)
{
cb.Items.Clear();//清空ComBox
SqlCommand cmd = new SqlCommand("select name from shop",DB.Getcon());//建構連接字串並切開啟資料庫連線
SqlDataReader sdr =cmd.ExecuteReader();
while (sdr.Read())
{
cb.Items.Add(sdr[0].ToString());//迴圈讀取資料
}//end block while
sdr.Close();// 關閉資料集
DB.GetColse();//關閉資料庫連線
}
------------------------------------------------------------------------------------------------
或者[private void Form1_Load(object sender, EventArgs e) { string sqlString = SELECT DISTINCT process FROM monFile; DataSet ds = GetDat
下邊是我用的方法
string ConnectionString = "Data Source=dzjc_2005;user=kk;password=kk;";//寫連接串
OracleConnection conn = new OracleConnection(ConnectionString);//建立一個新連接
conn.Open();
OracleCommand cmd = conn.CreateCommand();
cmd.CommandText = "SELECT rname,did,rchannel FROM nwvideo.n_road ";//在這兒寫sql陳述式
OracleDataReader dr = cmd.ExecuteReader();//建立一個OracleDateReader物件
if (dr.HasRows)
{
cmbChannelSelect.Items.Clear();//清空ComBox
while (dr.Read())
{
cmbChannelSelect.Items.Add(dr[2].ToString());//迴圈讀區資料
}
}
[想要形成這種效果的話,首先在資料裡面建一張表create table treedata (id number, context varchar2(50), parentid number);id:當前的id,context當前節點的值文字,pare