把If result.HasRows 改成 if (result.Read())

解决方案 »

  1.   

    what error did you get?try to calldr.Close()andresult.Close()Public Function IsCensor() As Integer
            '绑定客户类型下拉框
            Dim objCmd As New SqlCommand
            Dim objDr As SqlDataReader        objCmd.Connection = conn
            objCmd.CommandText = "select clda_id from tb_ClientData where clda_original_client_id=@ClientId"        objCmd.Parameters.Add("@ClientId", SqlDbType.Int).Value = Session("ClientID")        conn.Open()        objDr = objCmd.ExecuteReader()
            If objDr.HasRows Then
                IsCensor = objDr("clda_id")
            Else
                IsCensor = -1
            End If        dr.Close()
            objCmd.Dispose()
            'don't call conn.Close() since the other method will use it
        End Function
      

  2.   

    知道了,原来是没有写
    while objDr.read()loop
    呵呵见笑了。。