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

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 = [B]@myTitle[/B]

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.

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.

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 ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.