Click here to Skip to main content
15,889,931 members
Please Sign up or sign in to vote.
1.44/5 (2 votes)
I created a database named sbill.

It contains fields like billno, date,amount, particulars, quantity, name.

I created a datagrid view and displayed billno, date, amount. and also added a button named view to each row in gridview.

I want to display all the fields in the database to specific textboxes when clicking on the view button in that row. only the contents of clicked row should be shown in the textboxes.

Pleas help me...

What I have tried:

I created a datagrid view and displayed billno, date, amount. and also added a button named view to each row in gridview.

I want to display all the fields in the database to specific textboxes when clicking on the view button in that row. only the contents of clicked row should be shown in the textboxes.
Posted
Updated 12-Dec-17 4:46am
v2
Comments
RedDk 29-Dec-17 13:42pm    
While Solution 1 is without malice and a foregone conclusion, I'd like to add, since you didn't specify the version of VS you're using, that you install an Sql Server Management Studio Express with all the tools that accompany it as well as the BOL for the excellent help it contains. Expressly add to the download list the AdventureWorks database also. Because it specifically contains many of the sample DBs which the BOL holds in contempt of court but finds innocent upon judgment, once tried for runtime patency on the machine of choice.

1 solution

In that case you need simply in the CellClick Event of your gridview to get the value and to execute a "SELECT * FROM sbill WHERE some_field = value.
Then you show the result in the corresponding fields of the row - ready!
It seems to be a simple task ...
 
Share this answer
 
v3
Comments
Member 13572158 12-Dec-17 11:00am    
can you explain the codes.
Member 13572158 12-Dec-17 11:31am    
Anybody please explain me the codes please...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900