Getting error while adding values in DB- object reference not set to an instance of an object

Getting error while adding values in DB- object reference not set to an instance of an object.
I checked the log message for the variable values, that is also coming correctly.

DB connection is also fine.

Can anyone please help me to find out the issue.

Query -

“Insert Into Patient_Basic_Info Values ('”+
“Location,”+
“MRN_Num)”+
“Values (”+
“'”+Location+“',”+
“'”+MRN+“'”+
“);”

Error -

Error-

hi @vaibhav2.chavan ,

The query you are passing in the execute Query - can you take a writeline and print the query.

That Query you can verify and try executing the same in DataBase .


Mukesh

Hi @vaibhav2.chavan,

The error message indicates that one of the parameters being passed as null. Please check the values before passing to the query.

Regards,
PD

1 Like