Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

how do I update datagrid? Please help

Posted on 2011-03-06
8
Medium Priority
?
249 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
  • 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
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!

 
LVL 17

Accepted Solution

by:
nepaluz earned 1600 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 400 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Integration Management Part 2

927 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