I'm trying to fill a datagridview with a filtered dataset/view based on a text box selection.
I have found this code which i've added to a button click:
i am getting the following error :
Dim cnnStr As String
Dim sql As String
cnnStr = "Provider=SQLOLEDB;Data Source=myServer;User ID=myUser;Password=myPassword; Initial Catalog=myDatabase
sql = "Select JobStartDate, Job, StockCode, StockDescription, Customer, CustomerName, QtyToMake, QtyManufactured " & _
"from WipMaster " & _
"where Complete = 'N' and StockCode between '9000000' and '9999999' " & _
"order by JobStartDate"
con.ConnectionString = cnnStr
Dim dataAdapter As New OleDbDataAdapter(sql, con)
Dim ds As New DataSet()
Dim dsView As New DataView
Dim bs As New BindingSource()
dsView = ds.Tables(0).DefaultView
bs.DataSource = dsView
bs.Filter = " Job LIKE '" & Me.TextBoxJob.Text & "*'"
dgv_WipMaster.DataSource = bs
stringSystem.NullReferenceException was unhandled
Message=Object reference not set to an instance of an object.
I also have a datasource set up. Can i use that in my code instead of defining the connection.
this is my first VS effort to connect to a db so laymans terms please.