There are two ways
either you can send null value from C#
public static bool UpdateOpenVacancy(int id, string cadreName, int? cadreID, string instituteName, int? instituteID, string disciplineName, int? disciplineID, int? sanctionedStrength, int? inPosition, int? vacancy, int openVacancy)
{
SqlParameter[] param = {
new SqlParameter("@id", id),
new SqlParameter("@cadreName", cadreName),
new SqlParameter("@cadreId",cadreID),
new SqlParameter("@instituteName", instituteName),
new SqlParameter("@instituteId", instituteID==null?Convert.DBNull:instituteID),
new SqlParameter("@disciplineName", disciplineName),
};
using Convert.DBNull
or in stored procedure pass null value to parameters
ALTER PROCEDURE [dbo].[UpdateOpenVacancy]
@id int,
@cadreName VARCHAR(100),
@cadreID INT = null,
@instituteName VARCHAR(100) = null,
END
No comments:
Post a Comment