こんにちは、私はマイクロソフトのエンタープライズ ライブラリを使用しています。以下はコードです。
データセット用
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を取得しています....何か提案はありますか??