title: How can I export data from view to csv file with additional column?
body: <p>Besides exporting required fields from a view, I need to export an additional field, password. This field is not present in the view. It is a result of encrypting studentId field. Ex, if StudentId is ‘1234567’ then its password is 'ABCDEFG'. My codes as following.</p>
  
  <pre><code>    'assume the connection works 
      cmd1.CommandText = "select studentID from vwTEST"
      cmd1.ExecuteNonQuery()
      da.Fill(dt)
      For i As Integer = 0 To dt.Rows.Count - 1
          strStudentID = dt.Rows(i).Item(0)
          enc = encrypt(strStudentID)    ‘assume this function works
          updatePW(strStudentID, enc)
  Next
  </code></pre>
  
  <p>Everything works. But the rule is I can’t put passwords into the students table. Also, I can’t use a UDF on SQL Server. So, I try to create a virtue table that I will put all data in there, and then I will try to put the password (that is created by the encrypt function) in that virtual table before exporting data to csv file. How can I do that? Can you please help? Thanks in advance.</p>