Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

how do I update datagrid? Please help

Posted on 2011-03-06
8
Medium Priority
?
248 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

Technology Partners: 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

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
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…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

721 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