Access Output parameter in DAL in DNN

To keep the story short and simple.
In DNN, sqldataprovider class, you can write a function like this.

public override bool CreateItem(string itemname)
SqlParameter[] parameter = new SqlParameter[2];
parameter[0] = new SqlParameter(“@itemname”, itemname);
        parameter[1] = new SqlParameter(“@isadded”, SqlDbType.Bit);
parameter[1].Direction = ParameterDirection.Output;

SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure,     NamePrefix + “sp_insertitem”, parameter);
if ((bool)parameter[1].Value)
return true;//insert successful
return false;//insert fail.


Published by

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: