日期:2014-05-17  浏览次数:20769 次

从access数据库里读数据出错?
string sqlSignal="";
               string ClickedNode = FileTree.SelectedNode.Text.ToString();
               string FaNode = FileTree.SelectedNode.Parent.Text.ToString();
               string strSQL = "SELECT UPT FROM CfgEquipment Where 所属站=" + "'" + FaNode + "'" + "and 设备名称=" + "'" + ClickedNode + "'";
               OleDbConnection conn = new OleDbConnection();
               OleDbDataReader reader = null;
               conn = new OleDbConnection(strConnection);
               conn.Open();
               OleDbCommand command = conn.CreateCommand();
               command.CommandText = strSQL;
               reader = command.ExecuteReader();
               while (reader.Read())
               {
                   string strUPT = reader.GetInt32(0).ToString();
                   sqlSignal = "SELECT 信号名称 FROM CfgSignal Where UPT=" + "'" + strUPT + "'";
               }
               reader.Close();
               OleDbDataReader readerSignals = null;
               OleDbCommand commandSignals = conn.CreateCommand();
               commandSignals.CommandText = sqlSignal;
               MessageBoxEx.Show(sqlSignal);
               readerSignals = commandSignals.ExecuteReader();
               while (readerSignals.Read())
               {
                   String signals = readerSignals.GetString(0);
                   MessageBoxEx.Show(signals);
             &