[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 275
  • Last Modified:

How to retrieve data in vb.net 2010

Hi Experts,

How to retrieve data from database and display it in the grid from the selected values?

Thanks!!
0
developer2012
Asked:
developer2012
  • 3
  • 2
2 Solutions
 
CodeCruiserCommented:
>from the selected values?

What you mean by that?
0
 
developer2012Author Commented:
@ Code Cruiser: Selected Value: For instance user selects values (dates) from the application and time. When the user clicks show button. The data is displayed.Thanks.
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
CodeCruiserCommented:
So you want to load data based on filter. Without knowing much details about your requirements, here is a sample

Dim dbadp As New SqlDataAdapter("Select * From MyTable Where MyColumn = '" & txtName.Text & "'", "Your connection string goes here")
Dim dTable As New DataTable
dbadp.Fill(dTable)
dbadp.Dispose
DataGridView1.DataSource = dTable

Open in new window



If you need further help, show us a screenshot of your form and provide more details.
0
 
developer2012Author Commented:
Doc1.docx

Here is the screen shot for the question.  Thanks!!.

And how do I display the data in TExtBox When the user clicks on View Report. IT is generated in textbox not in the datagrid. Thanks
0
 
CodeCruiserCommented:
So it only returns one value? Or a list of values? If list then you would need to use a control like repeater, gridview, datalist etc to show the list. If one value then you can use command object to do a ExecuteScalar() and get single value.
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now