No data returned when using oledb

BeatMasterz

New Member
I am not clear to why its not returning data when it should. thequery.text does have a value.<BR><BR>Dim adapter As New OleDbDataAdapter()<BR> adapter.SelectCommand = new OleDbCommand("SELECT ID,NAME1 FROM CONTRACTOR_MASTER WHERE NAME1 LIKE '%" & thequery.text & "%'", MyConnection)<BR> <BR> MyConnection.Open()<BR> <BR> adapter.Fill(dataset,"contractors")<BR> <BR> EquipResults.DataSource=dataset.Tables("contractors").DefaultView<BR> EquipResults.DataBind()<BR> MyConnection.Close()<BR><BR>MattOk thats a new error on me. But any caseI changed my code to accept a parameter and it goes capoopy on me. Anyone ever experience this? I am gonna try to run this code with SQL Server instead of a 3rd party oledb driver to see if my code is right. Code is below:<BR><BR>Dim adapter As New OleDbDataAdapter()<BR> adapter.SelectCommand = new OleDbCommand("SELECT ID,NAME1 FROM CONTRACTOR_MASTER WHERE NAME1 LIKE ?", MyConnection)<BR> adapter.SelectCommand.Parameters.Add("@Query", OleDbType.VarChar, 10).Value = http://aspmessageboard.com/archive/index.php/"%" & thequery.text & "%"<BR> <BR> MyConnection.Open()<BR> <BR> adapter.Fill(dataset,"contractors")<BR> <BR> EquipResults.DataSource=dataset.Tables("contractors").DefaultView<BR> EquipResults.DataBind()<BR> MyConnection.Close()<BR><BR>MattProvider didnt like parameters so I just put the select together as a string and passed the entire string. So, I fixed it.<BR><BR>Matt
 
Back
Top