Solved

Representing columns data in Visual Basic .Net from a SQL database

Posted on 2009-07-14
5
202 Views
Last Modified: 2013-11-26
Hello,

I am writing a simple app in Visual Basic 2008 that will pull some data from a SQL database using a rather complex query and represent it in a form. Once this data is retrieved, a complex set of operations are carried out and displayed on another form in a similar tabular format

What is the best element to use to display this data (table, grid, etc). I know I can use datagridview, but i dont need the connection to be "live" - just extraction. Nothing needs to be written back to the database either. I imagine a listbox would work, but I would prefer that the end user have a simplistic excel-like interface.

Any example declarations would be greatly appreciated.

Thanks in advance.
0
Comment
Question by:ashbrookcorp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 48

Assisted Solution

by:jpaulino
jpaulino earned 100 total points
ID: 24854702
>> but I would prefer that the end user have a simplistic excel-like interface.

But the DataGridView don't need to save the change back to the database. In fact you have to write some code in order to do that.
 
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 400 total points
ID: 24857856
As said by JPaulino, datagridview does not write back to the database automatically if you do not configure it to do so. So you can retrieve the data from the db into a datatable. Use that datatable as the datasource of the grid and any changes made would remain in the datatable.

Here is an example of how to load and display using datatable


dim dTable as new datatable
dim dbadp as new sqldataadapter("select * from tablename", connectionstring)
dbadp.fill(dTable)
dbadp.dispose
datagridview1.DataSource = dTable

Open in new window

0
 

Author Closing Comment

by:ashbrookcorp
ID: 31603491
More points awarded to codecruiser for providing example code.
0
 
LVL 48

Expert Comment

by:jpaulino
ID: 24872828
>> More points awarded to codecruiser for providing example code.
You didn't asked that :)
No problem ... glad I could help.
0
 

Author Comment

by:ashbrookcorp
ID: 24878050
yeah i did!

>> Any example declarations would be greatly appreciated.

No matter. You contribute some great stuff to this forum - plus you are in the hall of fame here man!! :) (congrats on #1, BTW)
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

733 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