It depends which line it is on, really, but the most obvious candidate is:
cmd.CommandText = "Select * from b_asset_master";
If you have not assigned a value to cmd, then you will get this error.
Try changing it to:
cmd = new SqlCommand("Select * from b_asset_master", con);
and discard the line after it. The problem should go away.
When you get a problem like this, the first thing to do is look at the code in the debugger, and find the variable that is
null
- you can usually work out pretty easily from that what you need to do. And it's a lot, lot quicker than asking here each time! :laugh: