Click here to Skip to main content
16,020,677 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
strSQL = "SELECT * FROM Persons WHERE Condition ='Damage'"

then I want to display that in the datagrid

using this codes...

Stock_InDataGridView.DataSource = strSQL


I put that code in the form load but there is no display I can see in the datagrid why is that?

IM using vb.net
Posted

can you give fragment code of example
 
Share this answer
 
You're assigning a string as the datasource and the DataGridView has not a clue what to do with it so it does nothing. You'll have to actually execute the inline sql against the database, retrieve the dataset and bind that to the grid. Lookup ADO.Net, specifically the Connection, Command and DataAdapter classes. No shortage of examples.
 
Share this answer
 
Did you set up a connection to the database?
 
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