Question How to search for entry at database firebase

Tamiryosef

Active member
Joined
May 2, 2022
Messages
36
Programming Experience
1-3
Hi guys

I look for a way to enable the user to searches for item at my database.

For example my database is save on firebase real-time.
The data is save by date and time in side I have part number of the item and I whan the user enter a part number and find the entry at the database.

The database is stored like that
10/10/2022
==>part number:23242

The are a way to do that ?
 
You need to spend some time researching ADO.NET, which is the standard .NET data access technology. There's little point us showing you how to do this one thing because you'll just be back asking us how to do the next one thing. You should the basics for yourself and then ask about specific issues if and when you encounter them. You'll also need to learn the basics of SQL, to write your queries. There's a tutorial on the latter in here. As for ADO.NET, you can find plenty of information around but most beginner VB tutorials will cover the basics, so you can find a relevant link for that in my signature below.
 
i try to do it like that but i get error

search:
    Private Sub searchBt_Click(sender As Object, e As EventArgs) Handles searchBt.Click

        TryCast(DataGridView1.DataSource, DataTable).DefaultView.RowFilter =
            String.Format("ItemNum like '%" & searchTxt.Text & "%'")




    End Sub
 
error.jpg
 
Please don't post pictures of code or error messages. Post them both as the text they are, formatted appropriately.

As for the issue, you're trying to cast the DataSource of the grid as type DataTable. Did you assign a DataTable to that property in the first place? One won't just appear out of thin air. That code is for filtering data that you have already retrieved from the database and bound to the grid. Have you done that? I suspect not.
 
You need to actually query the database. There is probably no subject better covered than that on the web so you don't need me to repeat what's already out there a thousand times. I already pointed you to the tutorial link in my signature and that will show you what to do, so it doesn't seem like you've really tried. How about you forget trying to solve this specific problem with as little effort as possible for now and just try to learn how to work with databases in VB? Once you have learned the fundamentals, you can then apply what you've learned to this and any other situation.
 
i try to do it like that and no good news

code:
    Private Sub searchtext_TextChanged(sender As Object, e As EventArgs) Handles searchtext.TextChanged

        Dim res As FirebaseResponse = client.Get("addorderList")
        Dim data As Dictionary(Of String, addorderList) = JsonConvert.DeserializeObject(Of Dictionary(Of String, addorderList))(res.Body.ToString())


        TryCast(DataGridView1.DataSource(data), DataTable).DefaultView.RowFilter =
           String.Format("ItemNum LIKE '%" & searchtext.Text & "%'")
    End Sub
 
I may have led you astray. I don't use Firebase and have only heard about it in passing, so I just assumed that it was a regular database. It appears that that is not the case. My search for "vb.net firebase" led me here immediately. Is that of any use to you?
 
Back
Top