日期:2014-05-17 浏览次数:20999 次
1:
string ConnectionString = "Data Source=dzjc_2005;user=kk;password=kk;";//写连接串
OracleConnection conn = new OracleConnection(ConnectionString);//创建一个新连接
conn.Open();
OracleCommand cmd = conn.CreateCommand();
cmd.CommandText = "SELECT userid,username FROM users";//在这儿写sql语句
OracleDataReader dr = cmd.ExecuteReader();//创建一个OracleDateReader对象
if (dr.HasRows)
{
cmbChannelSelect.Items.Clear();//清空ComBox cmbChannelSelect==>ComBox下拉列表
while (dr.Read())
{
cmbChannelSelect.Items.Add(dr[2].ToString());//循环读区数据
}
}
if (this.txtName.Text == "")
{
MessageBox.Show("用户名不能为空!");
}
else
{