How to: perform a quick search against database table

Поделиться
HTML-код
  • Опубликовано: 11 дек 2024
  • a quick how to about performing a search against database table. Check the website: www.mkasoft.com

Комментарии • 63

  • @MrDjmclaughlin
    @MrDjmclaughlin 13 лет назад

    Man, this was EXACTLY what I needed! Thanks for taking the time to put these videos together! Keep up the great work!

  • @sathishraju3234
    @sathishraju3234 7 лет назад +1

    Hi,
    Direct name search without typing %.
    Button1_Click
    Time on Video 5:15
    Copy and paste the below code or check the code; I have added 2 % symbols after like.
    PersonDataGridView.DataSource = Me.TestDBDataSet .Person.Select("personname like '%" & TextBox1.Text & "%'")
    Once done, run and check, you will be able to search names without percentage symbol.
    I'm not a programmer but luckily it worked for me. Thought it might help others.

  • @mkaatr
    @mkaatr  13 лет назад

    @deathpedal
    Hi there...
    You could create a query adapter that execute the following sql "delete from mytable" replacing mytable with your table name. Since there is no where part then the sql will remove all records in that table. If you want to clear the whole DB then you need to execute this kind of SQL on every table, and also you need to take into consideration the Foreign key constraints while doing that.

  • @Dranzer151
    @Dranzer151 12 лет назад

    The simplest way must be to change the code for the button. Just automatically set a % after and/or before the text. That might solve your question. But if you want to search for matching results without "%" just do like Paul said: .Select("ColumnName LIKE '%" + TxtLike.Text + "%'")

  • @notta3d
    @notta3d 14 лет назад

    Thanks for the video. Looking forward to the UPDATE, INSERT and DELETE videos.

  • @sudani1969
    @sudani1969 13 лет назад +1

    Mkaatr you ARE THE MAN followed your instruction and added row count and it worked Dim dt As attendanceDataSetTableAdapters.DataTable1TableAdapter
    dt = New attendanceDataSetTableAdapters.DataTable1TableAdapter()
    dt.Fill(AttendanceDataSet.DataTable1) ,
    Dim rCf() As attendanceDataSet.DataTable1Row
    rCf = AttendanceDataSet.DataTable1.Select("username = '" & txtUser.Text & "' AND `date`= '" & Now.Date & "'")
    If rCf.Count > 0 Then
    MsgBox("Stop")
    Else

  • @Dranzer151
    @Dranzer151 12 лет назад

    You need to have a "If" first of all. After that you need a "Then". In the end you'll need "End If". In the middle you can use "Else" or "Elseif". If it doesn't work make sure it is "Connected" to the right If.

  • @shaolin113
    @shaolin113 14 лет назад

    Excellent tutorials....thank you :)

  • @mkaatr
    @mkaatr  13 лет назад

    @pinmedownbaby
    Hi there...
    Sorry about that... hopefully, the next set of tutorials have better audio quality.
    Thanks for the feed back , and happy new year :)

  • @wanfarok
    @wanfarok 10 лет назад

    this is great man! i'm really grateful

  • @mkaatr
    @mkaatr  12 лет назад

    I haven't worked in VB6 for a very long time. So I am afraid I can't be of much help. However you could create a SQL statement that filters data based on a specific parameters. This should work in VB6.

  • @mkaatr
    @mkaatr  13 лет назад

    @deathpedal
    Check 8:03 , you just change the search column to PersonID

  • @mkaatr
    @mkaatr  13 лет назад

    @landy1727
    Hi there...
    could you give more details on how did you make the search?

  • @sudani1969
    @sudani1969 13 лет назад

    hi mkaatr
    i watched your video it help me alot...but could you tell me if i have to different table i want to show only 2 columns from on table and other column from othe would i be able to displayed in 1 datagrid.. thanks evry one

  • @mkaatr
    @mkaatr  14 лет назад

    @Kyuoera
    Hi there...
    To perform printing of values that you read from the db, usually you need to use some kind of reporting solutions. You could write your own code to work with the printer, but it requires some work. The issue is not the database here. It is how you format your output to the printer.
    I will try to record a video tutorial about how to work with a printer when I get some free time.
    yours

  • @mkaatr
    @mkaatr  14 лет назад

    @Kyuoera
    Hi there...
    what do you mean by "print the database"? could you clarify please?
    yours

  • @samalex4548
    @samalex4548 10 лет назад

    Great job. this was really helpful thanks a ton

  • @fatmabenrejeb3979
    @fatmabenrejeb3979 9 лет назад

    thank you for your video , and if i want to use a combobox instead of textbox and want that items will be PersonID, StateID, PersonName and not their values , what must i do?

  • @Kvn12x
    @Kvn12x 10 лет назад +2

    Thanks for the video, really helpful, but I have a problem, everything works fine when I use the search button but when I'm done searching, my data grid appears blank. Could you help me?

  • @mkaatr
    @mkaatr  13 лет назад

    @loveemaw
    Hi there...
    Sorry for the late response, I was not very well last week. Could you give me more detail about the problem here?
    Are you getting a single row as a result? are you trying to cancel the search? Could you explain more?
    yours

  • @mkaatr
    @mkaatr  13 лет назад

    @sudani1969
    Hi there...
    You have most of your work done already. All you need to do is create a table adapter, the will join the two tables, and create a new Fill method that uses parameters - username and password for example.
    Next you run the query, and get the result, and you could just check the field in the item array:
    if (MyTable.Rows(0).ItemArray(3)=Now.Date) then
    the line above illustrates the idea i did not check its syntax. If you still have problem with this let me know.
    yours

  • @mkaatr
    @mkaatr  14 лет назад

    @notta3d
    Check out the DB tutorials at the website, and see how query adapters can help you perform Update,Insert and Delete. It is the sixth tutorial. Also, the video of the sixth db tutorial is available on the channel.
    yours.

  • @mkaatr
    @mkaatr  13 лет назад +1

    @sudani1969
    Try this:
    Dim DS As New AttendanceDataSet
    Dim DA As New AttendanceDataSetTableAdapters.t2TableAdapter
    DA.FillByMyFilterMethod(DS.t2,MyFilterValue)
    This won't work of course because I don't know the names and lots of other stuff, but focus on the idea here.
    The DS represents all the tables, you need to specify which table should be filled by the adapter.
    If you still having the issue, send me the DB design, and I will make a video about it.
    yours

  • @AmaruAria
    @AmaruAria 11 лет назад

    can we do this during text change event? i mean is it the same thing?

  • @utkarsh12
    @utkarsh12 12 лет назад

    hi!
    is there anyway to search without the %. if i want to search names starting with A, can i search A instead of A%??
    Thanks!

  • @edwinedwine9013
    @edwinedwine9013 10 лет назад

    helo great work been looking for this lines of code..

  • @mkaatr
    @mkaatr  13 лет назад

    @loveemaw
    I should be the one thanking you since I did not know about Filter.
    :)

  • @Teraprinny
    @Teraprinny 10 лет назад

    Could you do this on C#, please?

  • @riponkamal1
    @riponkamal1 13 лет назад

    Hello sir, thanks to you for excellent tutorial.
    Could you please help to search between two parameters.
    for example: there are five different dates in a date column. i would like to search dates between one to three and it shows on Data grid. Please please please please help me.

  • @matyg.c.8464
    @matyg.c.8464 12 лет назад

    hi could you please show how to add picture in your database which can be visible in data grid view during the search??

  • @fissehamalele4574
    @fissehamalele4574 11 лет назад

    That is great tutorial.but i need to ask one thing.I want to search a specific items from the table.how can i search any data by some characters.for example,names starting f,fi,fiss,fisse,fissseh,fisseha. and so on.thanks a lot for your cooperation in advance!

  • @mkaatr
    @mkaatr  13 лет назад

    @sudani1969
    Hi there...
    You could hide the columns you don't want to show simply, click on the datagridview, select edit columns, select the column you want to hide or delete , set its visible to false, or delete it all togather.
    as for displaying information from two tables in the same data grid, you have to create a new table adapter, then use a query to join both tables, and link a datagridview to that query.
    hope this help.
    yours

  • @FlakronSaidi
    @FlakronSaidi 13 лет назад

    @deathpedal I need it too, if you find the answer, please tell me
    Thank you

  • @radugabriel1627
    @radugabriel1627 6 лет назад

    How can I search for the items in database table without using the % at the end?

  • @sudani1969
    @sudani1969 13 лет назад

    hi Mkaatr
    still not working for me thanks by the way i'm doing very well following ur tutorial
    here is my data set name 'AttendanceDataSet1' has 3 tables i wanted to filter 't2' i manged the sql query but i'm failing where to set the dataset and creating tableAdapter i manged it using VS2010 schema bulider i know how to to do it in code when i set dim ds as new data set dim da as mysqldataadapter but this way i failed misreabley
    any advice

  • @morsteen
    @morsteen 8 лет назад +1

    I don't understand how making a simple app/frontend that is just a search isn't included as a point and click sort of thing yet. It's probably been around since the DOS database days, but we still have to try to mess with all of this stuff. So many videos, but none of them help me with my own database since I want to be able to search from any of my textboxes/all of my textboxes/combo of my textboxes/only one of my textboxes with one search button to filter the results. Can anyone help? Trying to make my own database of my thousands of photographs as a little project. It's easy to enter the records in Access, but no idea, even after spending two straight days watching video after video on this. It's all either way too complicated of a search, or way too simple.

  • @gligoormarinaada3303
    @gligoormarinaada3303 11 лет назад

    I salute... Thanks a lot :)

  • @jesferborce9347
    @jesferborce9347 5 лет назад

    Can i have a code if i want to search the whole datagrid?pls?

  • @mrmksekar
    @mrmksekar 9 лет назад

    I got "you cannot add or change a record because a related record is required in table" this error. Can you solve this one.

  • @NazriMazlan
    @NazriMazlan 10 лет назад

    Hello sir, how to perform search in UNION query?

  • @mkaatr
    @mkaatr  14 лет назад

    @banglaparade
    Hi there...
    could you send me the code, or an image?

  • @pearlgirlj
    @pearlgirlj 10 лет назад

    Hi. 1st, thank u for the video...
    When i click the search button it doesn't show me all columns. Plus some times it an exception error appears, Why is that happening??

    • @mkaatr
      @mkaatr  10 лет назад

      Could you post the error message?

  • @samalex4548
    @samalex4548 10 лет назад

    how can I contact you in private ? I really need your help if you dont mind

    • @mkaatr
      @mkaatr  10 лет назад

      Can't promise I will reply, but the email is: notes@mkasoft.com

  • @starkingize
    @starkingize 12 лет назад

    I want to learn to do that but in vb6

  • @MN-cg2uu
    @MN-cg2uu 10 лет назад

    dude the gud tutorial

  • @deathpedal
    @deathpedal 13 лет назад

    how to search the id?

  • @srgdimond43
    @srgdimond43 6 лет назад

    hello sir,Nice video i am using same format but i have one dateAndtime column datatype datetime ,,,i want to search record between range of time can you please help me that how can i search record using its time...

  • @mkaatr
    @mkaatr  13 лет назад

    @sudani1969
    Glad that it worked for you.
    yours

  • @ghostdumper
    @ghostdumper 12 лет назад

    Mine wont reconnize the use of "Then" and "elseIf" when im making the radio button... does anybody have a clue or another way to do it?!

  • @AbuOmar1974
    @AbuOmar1974 9 лет назад +5

    Thank you
    I guess for her to use
    like '%" etc......
    for example I search in to fields "Ar" and Eng"
    Private Sub TextBox1_KeyUp(sender As Object, e As KeyEventArgs) Handles TextBox1.KeyUp
    Me.DicDataGridView.DataSource = Me.CoDataSet.Dic.Select("Ar like '%" + TextBox1.Text + "%' or eng like '%" + TextBox1.Text & "%'")
    End Sub
    I hope this helpful

  • @MySwiftblade
    @MySwiftblade 11 лет назад

    thank you very much srsly thank you:)

  • @deathpedal
    @deathpedal 13 лет назад

    HI SIR CAN YOU POST A VIDEO ON HOW TO "DELETE ALL RECORDS" IN DATABASE? TY SIR... .

  • @deathpedal
    @deathpedal 13 лет назад

    how to search ID???????????????

  • @husseinalihussein2186
    @husseinalihussein2186 10 лет назад

    Put in your database this code
    Me.datafilenametableadapter (me._filenamedataset.datafilename)

  • @ejies112
    @ejies112 13 лет назад

    Shhhhhhhhhhhhhh..

  • @morpheushugo911
    @morpheushugo911 11 лет назад

    Man i cant understand any word you saying can you atleast make a subtitle of this? I mean it's a good lesson but bad sound quality. Sorry

    • @mkaatr
      @mkaatr  11 лет назад

      I agree with you. I fixed the sound problem in later tutorials.

  • @itsjustlester2967
    @itsjustlester2967 8 лет назад

    the faking view is always moving i cant concentrate on watching

    • @mkaatr
      @mkaatr  8 лет назад

      Sorry about that. In receipt videos I changed the recording software so the view is in full screen, which makes thing easier.