Try
            strConnection = ConfigurationSettings.AppSettings("connection")
            myConnection = New SqlConnection(strConnection)
            myConnection.Open()
            Dim strSQL As String
            strSQL = "select distinct year(ACCOUNT_DATE),month(account_date) from t_account_detail"
            Dim tempCommand As SqlCommand
            Dim tempReader As SqlDataReader
            Dim tempItem As ListItem
            tempCommand = New SqlCommand(strSQL, myConnection)            tempReader = tempCommand.ExecuteReader
            tempItem = New ListItem("--选择年月--", "0")
            drpMonth.Items.Add(tempItem)
            While tempReader.Read
                tempItem = New ListItem(tempReader.GetString(0) & "-" & tempReader.GetString(1), tempReader.GetString(0) & "-" & tempReader.GetString(1))
                drpMonth.Items.Add(tempItem)
            End While
            tempCommand.Dispose()
        Catch ex As Exception        Finally
            myConnection.Close()
        End Try
我那句sql语句(strSQL)我用查询分析器查了下,可以查到两条数据,但在后台代码中,tempReader.Read却为false,也就是tempReader里没数据
不知道为什么,请各位帮忙。谢谢了,在线等