[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 274
  • 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

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