This code will not work, it says unhandeled exception.
[red] Private Sub btnState_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnState.Click
Me.OleDbSelectCommand1.CommandText = "SELECT Name, [Company Name], Address, City, State, Zip, Telephone, PubID FROM Pub" & _
"lishers WHERE Name like " & cmbState.Text.ToString
Me.OleDbSelectCommand1.Connection = Me.OleDbConnection1
'
OleDbDataAdapter1.Fill(DataSet11)
OleDbDataAdapter2.Fill(DataSet11)
End Sub [/red]
This code works, it pulls everything in my table:
[green] Private Sub btnAll_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAll.Click
Me.OleDbSelectCommand1.CommandText = "SELECT Name, [Company Name], Address, City, State, Zip, Telephone, PubID FROM Pub" & _
"lishers"
Me.OleDbSelectCommand1.Connection = Me.OleDbConnection1
'
OleDbDataAdapter1.Fill(DataSet11)
OleDbDataAdapter2.Fill(DataSet11)
[/green]
[red] Private Sub btnState_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnState.Click
Me.OleDbSelectCommand1.CommandText = "SELECT Name, [Company Name], Address, City, State, Zip, Telephone, PubID FROM Pub" & _
"lishers WHERE Name like " & cmbState.Text.ToString
Me.OleDbSelectCommand1.Connection = Me.OleDbConnection1
'
OleDbDataAdapter1.Fill(DataSet11)
OleDbDataAdapter2.Fill(DataSet11)
End Sub [/red]
This code works, it pulls everything in my table:
[green] Private Sub btnAll_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAll.Click
Me.OleDbSelectCommand1.CommandText = "SELECT Name, [Company Name], Address, City, State, Zip, Telephone, PubID FROM Pub" & _
"lishers"
Me.OleDbSelectCommand1.Connection = Me.OleDbConnection1
'
OleDbDataAdapter1.Fill(DataSet11)
OleDbDataAdapter2.Fill(DataSet11)
[/green]