List<SqlDataRecord> sqlDataRecordListGISOfficers = new List<SqlDataRecord>();
SqlMetaData[] sqlMetaDataGISOfficers ={
new SqlMetaData("ColumnName", SqlDbType.NVarChar,100 ),
new SqlMetaData("ColumnName",SqlDbType.Int),
new SqlMetaData("ColumnName",SqlDbType.NVarChar,100),
new SqlMetaData("ColumnName",SqlDbType.Int),
new SqlMetaData ("ColumnName",SqlDbType.Bit),
new SqlMetaData("ColumnName",SqlDbType.NVarChar,100),
new SqlMetaData("ColumnName",SqlDbType.NVarChar,100)
};
if (application.ApplAssignedOfficers != null)
{
foreach (ApplAssignedOfficers AppOfficer in application.ApplAssignedOfficers)
{
SqlDataRecord sqlDataRecordApp = new SqlDataRecord(sqlMetaDataGISOfficers);
sqlDataRecordApp.SetSqlString(0, AppOfficer.ListName);
sqlDataRecordApp.SetInt32(1, AppOfficer.ListName);
sqlDataRecordApp.SetSqlString(2, AppOfficer.ListName);
sqlDataRecordApp.SetInt32(3, AppOfficer.ListName);
sqlDataRecordApp.SetBoolean(4, AppOfficer.ListName);
sqlDataRecordApp.SetSqlString(5, AppOfficer.ListName);
if (!string.IsNullOrEmpty(AppOfficer.ListName))
{
sqlDataRecordApp.SetSqlString(6, AppOfficer.ListName);
}
sqlDataRecordListGISOfficers.Add(sqlDataRecordApp);
}
}
SqlParameter tvpParam = new SqlParameter();
if (sqlDataRecordListGISOfficers.Count > 0)
{
tvpParam.ParameterName = "@ParameterName";
tvpParam.SqlDbType = SqlDbType.Structured;
tvpParam.TypeName = "TableTypeName";
tvpParam.Value = sqlDataRecordListGISOfficers;//List Name
cmd.Parameters.Add(tvpParam);
}
Need to MERGE statement at database side