Ohh actually getValuebyQuery is my own function I am enclosing here with so that you can use it. In this function you can use select/insert/update/delete query as you required..
<pre lang="vb"> Public oCon As New System.Data.OleDb.OleDbConnection("provider=microsoft.jet.OLEDB.4.0;data source=" & Application.StartupPath & "\Data\mydata.mdb")
Function GetValueByQuery(ByVal Query As String) As String
Dim temp As String
Dim ocom As New OleDbCommand
Dim oRead As OleDbDataReader
If oCon.State = ConnectionState.Closed Then
oCon.Open()
End If
ocom.Connection = oCon
ocom.CommandText = Query
oRead = ocom.ExecuteReader
If oRead.HasRows = True Then
oRead.Read()
If IsDBNull(oRead(0)) = True Then
temp = "0"
Else
temp = oRead(0)
End If
oRead.Close()
Else
temp = "0"
oRead.Close()
End If
Return temp
End Function</pre>