Click here to Skip to main content
15,895,709 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i am developing windows application in visual studio 2008 and database SQL 2005. In that project i am using Datagridview and from that datagridview i use event CellContentClick...i want to fetch data from database on click of the cell of datagridview....how to write the code for it ....please any one help me out to solve this problem....
Posted

1 solution

Add handler to the event:
(Something like this)
C#
protected void CellContent_Click(ObjectSender sender, EventArgs eventArgs)
{
// data access code here.
}


To access data you will need to creayte connection object, open it, create command, execute it and process the results.
Some examples can be found here:
Data reader example[^]
 
Share this answer
 

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