Passing parameter to datagridview

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: May 2007
Posts: 4
Reputation: olodu is an unknown quantity at this point 
Solved Threads: 0
olodu olodu is offline Offline
Newbie Poster

Passing parameter to datagridview

 
0
  #1
May 24th, 2007
Hi all,
I need help in passing parameter value to a datagridview control on my form. I have a form with a textbox control, a datagridview control and a button. When the user enters in the title of a movie in the textbox and clicks on the OK button, I would like that record to be retrieved from the database into the datagridview control. The datagridview is bound to a database table. Can someone please help. Sample code will be greatly appreciated.

Regards
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 45
Reputation: mike.mclennan is an unknown quantity at this point 
Solved Threads: 0
mike.mclennan's Avatar
mike.mclennan mike.mclennan is offline Offline
Light Poster

Re: Passing parameter to datagridview

 
0
  #2
May 24th, 2007
what your asking is a pretty easily completed task. what you need to do make a new select statement with a user defined variable. see below
Select MovieId, MovieTitle, MovieDesc
From Movies
Where MovieTitle = @myTitle

that @myTitle tells the TableAdapter that the value of @myTitle will be sent in, meaning it can be the text value of the text box. once you have created this new query you can then create a grid view from it, during the creation of the grid view it will ask you to assign any user defined parameters. select control as the type, and then the name of the text box as the value. should work easy enough.

hope that helps.
- mike mclennan
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 4
Reputation: olodu is an unknown quantity at this point 
Solved Threads: 0
olodu olodu is offline Offline
Newbie Poster

Re: Passing parameter to datagridview

 
0
  #3
Jun 30th, 2007
Hi All,

I need help in passing data from a datagridview control to textboxes control. When the user doubleclick a value from a datagridview control in form1, I want the record to be displayed in the texboxes of form2. How do I go about coding this? Any help would be highly welcome.
Last edited by olodu; Jun 30th, 2007 at 2:53 am. Reason: Bad
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 11
Reputation: Fritzeh is an unknown quantity at this point 
Solved Threads: 0
Fritzeh Fritzeh is offline Offline
Newbie Poster

Re: Passing parameter to datagridview

 
0
  #4
Apr 2nd, 2008
Hi, I have created the following sql statement in tblshopstableadapter:

SELECT ShopID, CategoryID, ShopName, Floor
FROM tblShops
WHERE (ShopName = '@Name')

How do i assign a data in a text box to @name ?
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for VB.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC