Solved

How to retrieve data in vb.net 2010

Posted on 2012-03-27
6
268 Views
Last Modified: 2012-06-27
Hi Experts,

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

Thanks!!
0
Comment
Question by:developer2012
  • 3
  • 2
6 Comments
 
LVL 9

Accepted Solution

by:
TonyReba earned 250 total points
ID: 37771770
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 37772149
>from the selected values?

What you mean by that?
0
 

Author Comment

by:developer2012
ID: 37772917
@ 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 83

Assisted Solution

by:CodeCruiser
CodeCruiser earned 250 total points
ID: 37774061
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
 

Author Comment

by:developer2012
ID: 37778291
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
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 37866840
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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question