Hey Guys and gals
I'm trying to code a search button to pull back info from access database and populate text and combo boxes as wellas a couple date time pickers. I can't seem to get the program to bring back any results. this is the code i have (and please tell me if there is an easier way to do what i'm trying to do.)
this is run from a cmd_click on btnGO when i run it, i get IndexOutOfRangeException was unhandledCode:connection.ConnectionString = "provider=microsoft.jet.oledb.4.0;Data source=q:\data\isim.mdb" connection.Open() searchtime = "SELECT * FROM isimtable WHERE serial = '*" & tbSerial.Text & "*'" adapter = New OleDb.OleDbDataAdapter(searchtime, connection) adapter.Fill(searchresults, "Search") cbModel.Text = searchresults.Tables("search").Rows(0).Item(1) tbSerial.Text = searchresults.Tables("search").Rows(0).Item(2) tbAsset.Text = searchresults.Tables("search").Rows(0).Item(3) rtbHistory.Text = searchresults.Tables("search").Rows(0).Item(4) rtbNotes.Text = searchresults.Tables("search").Rows(0).Item(5) tbUser.Text = searchresults.Tables("search").Rows(0).Item(6) cbLocation.Text = searchresults.Tables("search").Rows(0).Item(7) cbSchedule.Text = searchresults.Tables("search").Rows(0).Item(8) dtpDateSent.Text = searchresults.Tables("search").Rows(0).Item(9) dtpDateRec.Text = searchresults.Tables("search").Rows(0).Item(10) tbPrevUser.Text = searchresults.Tables("search").Rows(0).Item(11)
There is no row at position 0, so what i gather is the dataset is not filling with any info. Problem is i can't figure out why. I know what i enter when i search is valid in the database. Please help. Any suggestions would be great.




Reply With Quote