The problem is the email_count value from the dataset is always 1 whether the e-mail address is found or not. But if I copy the exact sql string variable value and paste it into a Query in SQL Server Management Studio, some of the results are 0.
Dim connectionString As String = "Data Source=AV-W12-ROMS-1;Initial Catalog=RESUMES;Integrated Security=True" Dim sql As String = "" Dim connection As New SqlConnection(connectionString) Dim dataadapter As New SqlDataAdapter(sql, connection) Dim ds As New DataSet() Later on, there's a Loop reading lines in a TextBox: sql = "SELECT IsNull(SUM(1),0) as 'count' FROM [RESUMES].[dbo].[ftbl_resume_files] WHERE contains(file_stream, '" + email_address + "')" connection.Open() ds.Clear() dataadapter.Fill(ds) connection.Close() email_count = ds.Tables(0).Rows(0).Item(0) Main.DataGridViewCandidates.Rows.Add(candidate_name, email_address + " (" + email_count.ToString + ")", activity_date, date_available, title, skills_list, sql) End of Loop
Do more with