I want to get the rows count of the DataSet, but the code here throws an exception
Dim con As New SqlConnection("server=localhost;database=MSDSS;Integrated Security=True")
Dim i As Integer
con.Open()
Dim qstr As String = "Select * From SJournal"
Dim sqladp As New SqlDataAdapter(qstr, con)
Dim dt As New DataSet
sqladp.Fill(dt, "SJ")
Dim j As Integer = dt.Tables("SJ").Rows.Count
For i = 0 To j Step 1
Dim rowname As String = dt.Tables("SJ").Rows(i)("JournalName")
Next
here is how I Calculate the string similarity
Dim Kq As Double = 2
Dim Kr As Double = 1
Dim Ks As Double = 1
Dim ss() As Char = rowname.ToCharArray()
Dim st() As Char = journalname.ToCharArray()
Dim q As Integer = ss.Intersect(st).Count()
Dim s As Integer = ss.Length - q
Dim r As Integer = st.Length - q
Dim total As Double = (Kq * q) / (Kq * q + Kr * r + Ks * s)
Please give me solution
The
Datatableworks like an array (in some way, when you use it on a for), and the index numeration of arrays goes from 0 to N-1Considering N is the number of rows, you should modify this
to
So, if got 3
rows, the for cycle will go from 0 to 2