I have written a method in c# in which I want to insert some data in sql database table. This method is accepting a Datatable parameter which I want to pass as parameter to stored procedure but there is some syntax issue. Please have a look at the following code-
public int SaveProcessingRecords(long policyDownloadId,string comment, string commentBy,string commentStatus, string questionType, DataTable policyResponseMappingTable)
{
Database db = DatabaseFactory.CreateDatabase(DLConnection.GetConnection());
DbCommand dbCmd = db.GetStoredProcCommand("ProcessingAreaINSERT");
db.AddInParameter(dbCmd, "@policyDownloadId", DbType.Int64, policyDownloadId);
db.AddInParameter(dbCmd, "@comment", DbType.String, comment);
db.AddInParameter(dbCmd, "@commentBy", DbType.String, commentBy);
db.AddInParameter(dbCmd, "@commentStatus", DbType.String, commentStatus);
db.AddInParameter(dbCmd, "@questionType", DbType.String, questionType);
db.AddInParameter(dbCmd, "@policyResponseMappingTable", SqlDbType.Structured, policyResponseMappingTable);
return db.ExecuteNonQuery(dbCmd);
}