What value are you trying to put into the textbox? What column and row in the underlying dataSource is it in ? Do you need to search the dataSource for the value or does your query select a single value --- 'Command.ExecuteScalar' As you can see there is a lot of info we would need to answer your question. Showing the code that retrieves the data would help alot....
my database contains a table of products with five columns: ID, Reference, quantity,the turnover, and categories, I want to show in textboxes the number of references that match a category, the sum of quantities.ofcourse my query select a single value.
I just write the class of connection I have not write any code for textboxes
Hello kRod, I found the solution, that's it: the message box return the result of my query, but the problem that i can't retrieve this result in my texbox, when my program is running, an error message appears: "impossible to change the property Connection String"
Private Sub TextBox4_TextChanged_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox4.TextChanged
dbProvider = "Provider=Microsoft.ACE.OLEDB.12.0;"
dbSource = "Data Source=C:\Users\Gayzlein\Documents\Gestion.accdb"
con.ConnectionString = dbProvider & dbSource
Dim cmd As New OleDb.OleDbCommand("select count(*) from Categories1 where classe='A'", con)
Dim count As Int32 = CInt(cmd.ExecuteScalar)
TextBox4.Text = cstr(count)