I guess you should put a breakpoint just before the objConnection.close() and start using messagebox or debug.print to verify the number of records in objDataSet.tables("student")
Once you know if you got any results then you'll know where to continue troubleshooting (the connection/db or your datagridview)
PS: Check the value of grdPublication.AutoGenerateColumns it should be true since you are not adding columns manually. If it's set to False then set it to True just before setting the datasource.
adam_k
Veteran Poster
1,057 posts since Jun 2011
Reputation Points: 274
Solved Threads: 205
Skill Endorsements: 11
Have you checked that your dataset contains rows?
adam_k
Veteran Poster
1,057 posts since Jun 2011
Reputation Points: 274
Solved Threads: 205
Skill Endorsements: 11
This: Dim objDataSet As DataSet = New DataSet() means that you are using a dataset.
A dataset is a collection of datatables or a way to temporarily store data in memory. A datagridview is a way of presenting data to the user.
Since you are not seeing any data in your datagridview this means that either you are not retrieving them correctly or that you are not showing them correctly.
A step by step approach to checking if you've retrieved data:
Below the fill command enter msgbox(objDataSet.tables("student").rows.count) Run your program. You'll get a message box with the number of rows in your dataset for the table student. If it's not 0 then we need to check the datagridview. If it is 0 then it's your db.
adam_k
Veteran Poster
1,057 posts since Jun 2011
Reputation Points: 274
Solved Threads: 205
Skill Endorsements: 11