For Each dr1 In reportData.Tables(0).Rows
Dim con4 As New SqlConnection("Data Source=INSIGHT-002;Initial Catalog=TNVKP_8;user id=sa;")
con4.Open()
Dim cmdclustr As New SqlCommand("select ParentUnitID from M_RptUnit where Rpt_Unit_ID='" + dr1("VPRC_ID") + "'", con4)
Dim redclustr As SqlDataReader
redclustr = cmdclustr.ExecuteReader()
If (redclustr.Read()) Then
clusterid = redclustr("ParentUnitID")
Dim login As String
login = Convert.ToString(Session(ssnLOGIN_ID)).ToUpper()
'If ((Convert.ToString(redclustr("ParentUnitID"))).ToUpper() = (Convert.ToString(Session(ssnLOGIN_ID))).ToUpper()) Then
Response.Write(login)
Response.Write(clusterid)
'Response.End()
If clusterid.ToString() = login.ToString() Then
check = 1
Response.Write("HAI HAI")
Response.Write(check)
Response.End()
Else
check1 = 2
Response.Write(check1)
Response.End()
End If
End If
redclustr.Close()
Next
From the above code i m having an error
Always it executing the else part(CHECK1=2) post solution for this
Thanks in advance
From the above code i m having an error
Always it executing the else part(CHECK1=2) post solution for this
Thanks in advance

Pravin GhadgeRank #1,340 · 1.3K reputationPosted Dec 19, 2011, 10:38 PM EST
If convert.Tostring(clusterid.ToUpper()) = login.ToString() Then
check = 1
Response.Write("HAI HAI")
Response.Write(check)
Response.End()
Else
check1 = 2
Response.Write(check1)
Response.End()
End If
This may help u!
Plz reply if ur problem is not resolved.
Suthish NairRank #92 · 22.8K reputationPosted Dec 19, 2011, 10:43 PM EST
Manikavelu VelayuthamRank #413 · 6K reputationPosted Dec 19, 2011, 10:52 PM EST
You can ignore the case using the boolean value.
Performance wise its faster than normal == function in string comparison.
Rajkumar R175 reputationPosted Dec 19, 2011, 10:59 PM EST
Manikavelu VelayuthamRank #413 · 6K reputationPosted Dec 19, 2011, 11:07 PM EST
Try it out with strTestSubject1.Equals(strTestSubject2)