Solved

how do I update datagrid? Please help

Posted on 2011-03-06
8
245 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

636 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