asp.net错误给我行数零

时间:2013-06-01 06:48:37

标签: asp.net sql-server enterprise-library

我在下面使用微软企业库是代码

用于数据集

Public Function FetchUserValue(ByVal uemail As String) As DataSet
    Dim ds As New DataSet()
    Try
        Dim query As String = String.Format("select * from v_userdetails where uemail='{0}' ", uemail)
        Dim cmd As New SqlCommand(query, con)
        Dim adapter As New SqlDataAdapter(cmd)
        adapter.Fill(ds)
    Catch ex As Exception
        MsgBox(ex.Message)
    End Try
    Return ds
End Function

功能背后的代码

Dim obj As New barter
Dim sb As New StringBuilder()
Dim user As String = CookieUtil.GetEncryptedCookieValue("MERE1000CR").ToString
Try
    Dim dtProducts As DataTable = obj.FetchUserValue(user).Tables(0)
    Dim rp As System.Data.DataRow
    If dtProducts.Rows.Count > 0 Then
    For rowIndex As Integer = 0 To dtProducts.Rows.Count - 1
        rp = dtProducts.Rows(rowIndex)
        Try
        If Convert.ToInt32(rp(0)) = 1 Then
            sb.Append(" <div>Welcome " & Convert.ToInt32(rp(2)).ToString & "</div>" & _
                  "<div class='dps'><img src='" & Convert.ToInt32(rp(9)).ToString & "' width='100px'/></div><div class='inf'></div></div style='clear:both'></div>")

        ElseIf Convert.ToInt32(rp(0)) = 0 Then
            Response.Redirect("Activation.aspx")
        ElseIf Convert.ToInt32(rp(0)) = 2 Then
            Response.Redirect("Blocked.aspx")
        End If

        Catch ex As Exception
        MsgBox(ex.Message)
        End Try
    Next
    profiler.InnerHtml = sb.ToString
    Else
    MsgBox("something wrong...")
    End If
Catch ex As Exception
    MsgBox(ex.Message)
End Try

即使在我在sql中运行相同查询时有行,我也会得到行数0.任何建议?

0 个答案:

没有答案