borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2009 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (checking several columns before update)Next Topic (adding other control in FlexGrid or Listview control) New Topic New Poll Post Reply
AndreaVB Forum : Database : Database searching
Poster Message
Muthu
Level: Trainee

Registered: 20-02-2008
Posts: 2

icon Database searching

I have created student  database in MS Access name "Student.mdb" table name is "student list" table having four fiedls name 1.Registration No, 2.Student Name, 3.standard, 4. city . In vb i have designed one form "frmsearch" in that i have placed one text box name "txtsearch, two option button, name "optsearchmode Regno" & "optsearch mode alphabetical " and on datagrid contol & one command button name "cmdsearch"

My question is
1. user  optsearch mode Regno and enter Regno in txt search and click seach command button the resulat will display MessageBox, Found Or not.

2. user optsearch mode alphabetical and enter *A* in txt search and click search command button the resulat will display in Datagrid control only the name begin with A.

how to wite the code for above my question

Note: I am connecting the database using ADODC

awaiting your valuable reply

21-02-2008 at 11:55 AM
View Profile Send Email to User Show All Posts | Quote Reply
noknok
Level: Scholar

Registered: 23-11-2007
Posts: 42
icon Re: Database searching

http://www.andreavb.com/forum/viewtopic_8073.html

this link contains with attached zip files by sir Stickleporject i hope helps u


or

http://www.andreavb.com/forum/viewtopic_8101.html

15-01-2009 at 12:12 PM
View Profile Send Email to User Show All Posts | Quote Reply
Tom
Level: Protégé

Registered: 24-03-2009
Posts: 5
icon Re: Database searching

Ummm you didnt specify what was being searched. At the time the user chooses to search, does it go to the database and run the query or is the data already retrieved and in a dataset/datatable on the local PC to be searched?

Assuming the latter, for the first (RegNo) which is returning an actual result to be displayed in a msgbox, I would suggest using the datatable.Select method.

Dim rowsFound() as DataRow
rowsFound = myDataset.Tables("TableName").Select("RegNo = ") & cint(txtSearch.Text)

If rowsFound.Length > 0 then
    'return 1st result
     Msgbox rowsFound("StudentName").tostring
End If

For the second I would use a dataview since the results can be bound to a datagridview control for viewing purposes

dim dvSearch as DataView(myDataset.Tables("tablename")

dvSearch.RowFilter = "StudentName Like '" & txtSearch.Text & "%'

DatagridView1.DataSource = dvSearch

24-03-2009 at 02:02 PM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : Database : Database searching
Previous Topic (checking several columns before update)Next Topic (adding other control in FlexGrid or Listview control) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2009 Andrea Tincaniborder