- Edited
hey,
i'm trying to write a small thing with vb.net using visual studio 2008
and i am new to VB and the .net framework
however after some google'ng i managed to understand few stuff and i wrote a small example where i have a button, text box and a DataGridView
the user enter a word in the text box and click the button
the program search the database basing on the user word
however it is not working, can anyone help me.
this is the code
the error is at this line "da.fill(ds)" it says No value given for one or more required parameters.
this is the whole code
i'm trying to write a small thing with vb.net using visual studio 2008
and i am new to VB and the .net framework
however after some google'ng i managed to understand few stuff and i wrote a small example where i have a button, text box and a DataGridView
the user enter a word in the text box and click the button
the program search the database basing on the user word
however it is not working, can anyone help me.
this is the code
the error is at this line "da.fill(ds)" it says No value given for one or more required parameters.
this is the whole code
Imports System.Data.OleDb
Public Class Form1
Dim query As String
Dim kword As String
Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click
Dim dbConn As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\db.accdb;User Id=admin;Password=;")
dbConn.Open()
Dim ds As New DataSet
kword = txtSearch.Text.ToString
query = "SELECT * from Table1 where addres LIKE " + kword
Dim da As New OleDbDataAdapter(query, dbConn)
da.Fill(ds)
dgv.DataSource = ds.Tables(0)
da.Dispose()
dbConn.Close()
End Sub
End Class