日期:2014-05-18 浏览次数:20807 次
public void SqlDEPTTree_NodeSelected(
TreeNode node = tree.SelectedNode;
if (node != null)
{
try
{
CFSQLConnect();
OleDbCommand cmd = CFSConn.CreateCommand();
cmd.CommandText = "select D_ID,D_BName,D_KName from Tb_Dept where D_KName='" + node.Text + "'";
OleDbDataReader myread = cmd.ExecuteReader();
if (myread.Read())
{
Datagridview1[i,j]= myread["D_ID"].ToString();
......
......
}
CFSConn.Close();
cmd.Dispose();
myread.Dispose();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}