建议你对每个SqlCommand使用单独的操作
cmdEmpName.connection.open()
cboName.DataSource = cmdEmpName.ExecuteReader
cboName.DataBind()
cmdEmpName.connection.close()

解决方案 »

  1.   

    dgEmpList.DataSource = cmdEmpList.ExecuteReader()
    cmdEmpList.Close();
      

  2.   

    cmdEmpList.Close()
    显示出错!
      

  3.   

    将connection关掉是否代价太大?
      

  4.   

    问题出在两个Command公用了一个connection
    将connection关掉代价不是很大的
      

  5.   

    运行cmdEmpName.ExecuteReader()之前,运行cmdEmpList.ExecuteReader().close()看看
      

  6.   

    应该关闭cmdEmpList.ExecuteReader()
      

  7.   

    Dim dr As SqlDataReader
    dr = cmdEmpList.ExecuteReader()
    dgEmpList.DataSource = dr
    dgEmpList.DataBind()
    dr.Close()
      

  8.   

    运行如下程序后不报错:Dim drEmp as SqlDataReader
    cmdEmpName = New SqlCommand("SELECT DISTINCT OFFICIAL_NAME FROM EMPLOYEE", Connection)
    drEmp = cmdEmpName.ExecuteReader()
    ddlEmpName.DataSource = drEmp
    ddlEmpName.DataBind()
    drEmp.Close()但怎么ddlEmpName(DropDownList) 中显示的全是以下信息:System.Data.Common.DbDataRecord但同样的数据在datagrid中绑定就没有问题。请各位指教!
      

  9.   

    又测试了一个新的dropdownlist控件,还是同样的显示(程序并未报错),dropdownlist控件中显示的是一"System.Data.Common.DbDataRecord"列表。
      

  10.   

    dataReader  must be colsed when your a common open another datareader,it's general knowledge.in other words, dataReaders must not share a connection.
      

  11.   

    已解决,只要指定DATATEXTFILED即可!谢谢各位!