title: Inserting a List<> into SQL Server table
body: <p>I have an entity <code>Report</code> whose values I want to insert into a database table. The following attributes of <code>Report</code> have to be inserted:</p>
  
  <pre><code>reportID - int
  RoleID - int
  Created_BY = SYSTEM(default)
  CURRENT_TIMESTAMP
  </code></pre>
  
  <p>Now the problem is with the 2nd attribute. I have a report with the <code>LIST&lt;ROLES&gt;</code> attributes. <code>ROLES</code> is a well defined entity which has an <code>ID</code> and a <code>NAME</code>. From this list I have to extract every role and insert each role's ID into the table.</p>
  
  <p>So my query presently looks as below :</p>
  
  <pre><code>INSERT INTO REPORT_MARJORIE_ROLE(REPORT_ID, ROLE_ID, CREATED_BY, CREATED)
  VALUES({0}, {1}, 'SYSTEM', CURRENT_TIMESTAMP)
  </code></pre>
  
  <p>The C# code from where I am parsing these values is as follows : </p>
  
  <pre><code>try
  {
      StringBuilder _objSQL = new StringBuilder();
      _objSQL.AppendFormat(Queries.Report.ReportQueries.ADD_NEW_ROLES, report.ID, "report.MarjorieRoles.Add(MarjorieRole")); 
      _objDBWriteConnection.ExecuteQuery(_objSQL.ToString());
      _objDBWriteConnection.Commit();
      _IsRolesAdded = true;
  }
  </code></pre>
  
  <p>So please guide me how to add roles from C# function</p>