Solved

how do I update datagrid? Please help

Posted on 2011-03-06
8
244 Views
Last Modified: 2012-05-11
Hello,

I'm extremely lost and need a little help on how to proceed.

I am making a form so when the date of birth is entered, if there's a user in the database with the same date of birth, it should update and show that user's information in the datagrid.... if it's not in the database, then it should allow the user to finish entering it in.

GOAL:
link the text box entry to check the database and update the datagrid so it displays information if available.

I think it has something to do with databinding the textbox and the datagrid together somehow, but not sure where to start...

Please help or point me in a place I can learn  

Thanks in advance for any help you can provide!
0
Comment
Question by:Obiki94
[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
  • 3
  • 3
  • 2
8 Comments
 
LVL 17

Expert Comment

by:nepaluz
ID: 35049653
OK lets start with the database, how are you calling your database?

Then, do you want an auto-complete for the textbox (I bet NOT), and if not, how does the form know that the user has completed entering the date of birth? Is there a button to press?
0
 

Author Comment

by:Obiki94
ID: 35049933
I created a DataSet  (DataSet.xsd) and when I created my datagrid, I pulled from my toolbox and selected my DataSource from the list.  It's a SQL 2008 database and it's regarding only one table [users].  

Currently all the users show in the datagrid...

you are correct, no autocomplete if possible.  I've added a button on the page named (btnCheck) to be used to check the database and update the datagrid  -  if it could be done by tabbing off the field, would work too....

I'll be totally honest, I come from a long line of classic ASP and can do ADODB database connections, recordsets, etc...  but doing this in Visual Studio 2010 is a bit different.

I know I must sound like a total noob, just an old man who's went back to school to learn VB.net and it's kicking my ****.
0
 
LVL 8

Expert Comment

by:PagodNaUtak
ID: 35050537
Is it windows form or a ASP.Net? The implementation of the two is different...
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 17

Accepted Solution

by:
nepaluz earned 400 total points
ID: 35050572
So if you only require the one record to show then why do you put it in a datagridview? Anyway, that should not be my concern for now.

You will have to unbind your datagridview from the datasourse and simply make a query to the dataset / datatable and bind the result of that query to the datagridview instead. Here is some code to place in your Button_Click event

                Dim TestDS As New DataSet 'this is already defined in your case
                Dim orders = TestDS.Tables("users") 'you need this
                Dim query = From o In orders.Rows Where o("DateOFBirth") = "06/03/2011" Select o 'and this should be the result
                Me.DataGridView1.DataSource = query 'binding this to the grid should display the result. If empty, no result

Open in new window


You clould also add some code in your TextBox_Enter event to clear the datagridview datasource, thus clearing the grid.
0
 
LVL 8

Assisted Solution

by:PagodNaUtak
PagodNaUtak earned 100 total points
ID: 35050574
0
 
LVL 8

Expert Comment

by:PagodNaUtak
ID: 35050632
You can also try this  one:
http://www.daniweb.com/forums/thread37972.html
0
 

Author Comment

by:Obiki94
ID: 35051135
Thank you all very much!!!   I was able to make it work... now if I just don't break it.
0
 

Author Closing Comment

by:Obiki94
ID: 35051158
nepaluz is awesome!!!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

734 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