Hi Narasiman,
Please find the sample code to compare the string value with db value and reading the matched row data.
Public Sub CompareDBValue()
Try
Dim con As New SqlConnection
Dim cmd As New SqlCommand
Dim aaf As String = "AAF"
con.ConnectionString = "Data Source=VDC01DDS-1072\SQLEXPRESS;Initial Catalog=UserDatabase;Integrated Security=SSPI;"
cmd.CommandText = "select * from Course"
cmd.CommandType = Data.CommandType.Text
cmd.Connection = con
Dim dA As New SqlDataAdapter
Dim ds As New DataSet
dA.Fill(ds)
For Each tbRow In ds.Tables(0).Rows
If String.Compare(aaf.ToLower(), tbRow("Coursename ").ToString().ToLower()) Then
' read the matched row data
End If
Next
Catch ex As Exception
End Try
End Sub
I hope this code will helps you.
Thanks,
Murali.MD