Any example code in C#.net with webparts, how to connect to SQL server and display a table data in SPGridView.
IMO this is the best tutorial on SPGridView :
You can easily modify ObjectDataSource SelectData method to return data from SQL server.
Some additional info can be found in my answer provided on following question:
find the below links,these might help http://www.componentart.com/community/forums/t/64014.aspx http://ctrlcvprogrammer.blogspot.in/2012/02/display-sql-server-data-in-gridview.html