The best advice for such of error is to use debugger. So, debug your programm and check what object is
null
.
See
past Sergey's answers too[
^] for further details.
Note: you're trying to insert data, so... you heave to use
ExecuteNonQuery method[
^].
To be able to fetch data, use proper
SELECT
statement, then you'll be able to use
DataSet
,
DataAdapter
, etc.