Click here to Skip to main content
15,892,697 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
cnn.Open()
cmd.CommandText = "SELECT `slno`, `id`, `fname`, `lname`, `startdate` FROM `all` "
dr = cmd.ExecuteReader
DataGridView2.DataSource = dr
MsgBox("data show to grid view ", vbInformation)
dr.Close()

cnn.Close()
Posted
Comments
tiFoysal 31-Mar-14 1:51am    
message showed but data did not showed in gridview
LaxmikantYadav 31-Mar-14 1:56am    
Please verify weather all tables contains some records ?
Peter Leow 31-Mar-14 2:40am    
What is your database? MySQL?
tiFoysal 16-Sep-15 2:30am    
Yes

1 solution

I do not think you can use a data reader as source for a DataGridView. See http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.datasource(v=vs.110).aspx[^] for a sample of how to do it.
 
Share this answer
 

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


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