944,020 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 7809
  • VB.NET RSS
May 24th, 2007
0

Passing parameter to datagridview

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
olodu is offline Offline
4 posts
since May 2007
May 24th, 2007
0

Re: Passing parameter to datagridview

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.
Reputation Points: 39
Solved Threads: 0
Light Poster
mike.mclennan is offline Offline
45 posts
since May 2007
Jun 30th, 2007
0

Re: Passing parameter to datagridview

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
olodu is offline Offline
4 posts
since May 2007
Apr 2nd, 2008
0

Re: Passing parameter to datagridview

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 ?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Fritzeh is offline Offline
11 posts
since Apr 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: Datagridview question
Next Thread in VB.NET Forum Timeline: ok how about this





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC