Question How do i insert an empty row into datagridview?

stresss

Member
Joined
Aug 11, 2008
Messages
21
Programming Experience
Beginner
Hey!

Anyone out there knows how to insert an empty row into datagridview when I clicked an Insert button and reflect it in the datagridview? And also how do I refresh the datagridview after I update it.?

Thanks alot! :).
 
Hey! Thanks for the code. But may I know do I put this after my close connection or before it? And what if some of my fields in my table don't allow null?

And don't mind me asking one more question ya :). Let's say I have a foreign key in this paricular table, how do I retrieve the data and display it in the datagridview. Let's say I have this table with MsgID which is a foreign key. Any idea? Sorry if it sounds messy :)

Thanks!
 
look at sql joins.

select table1.field1 ,table1.field2,msgtable.msgname from table1,msgtable where table1.id =messagetable.msgid

edit query in dataset designer to take info from two tables.

or
create adapter through code and fiill dataset.

set the datagrid data source property to the dataset.

vincent
 
Hey! Thanks for the code. But may I know do I put this after my close connection or before it? And what if some of my fields in my table don't allow null?

You can set in the Column-Setup the Null-Value for this cells. I think it's under the point 'Default Style' or something.

Bobby
 
Back
Top