Imports System.Data.OleDb
.
.
.
Dim conStr As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Documents and Settings\Sand\Desktop\เอกสารเตรียมสู่ฐานข้อมูล 4\Scopus.accdb;"
Dim conn As New OleDb.OleDbConnection(conStr)
Code (VB.NET)
Sub Ex_Query()
For i As Integer = 0 To DataGridView1.RowCount - 1
If Not DataGridView1.Rows(i).Cells(1).Value Is Nothing Then
word3 = DataGridView1.Rows(i).Cells(1).Value.ToString
OpenDB()
Dim sql As String = "SELECT COUNT (ID) as ""Computer"" FROM Scopus WHERE ((Authors LIKE '*" & word3 & "*') or (Title LIKE '*" & word3 & "*') or (Source_title LIKE '*" & word3 & "*') or (Affiliations LIKE '*" & word3 & "*') or (Abstract LIKE '*" & word3 & "*') or (Author_keywords LIKE '*" & word3 & "*') or (Index_keywords LIKE '*" & word3 & "*') or (References_ LIKE '*" & word3 & "*'))"
Dim adapter As New OleDbDataAdapter(sql, conn)
Dim data As New DataSet()
adapter.Fill(data, "Scopus")
End If
Next
End Sub