title: Assign DataRowView field to integer variable
body: <p>I have created a dataview that bring data from SQL Server and allows me to set the text of textboxes.</p>
  
  <pre><code>DataView dv = (DataView)SQLDSRecordPageTest2.Select(DataSourceSelectArguments.Empty);
  
          foreach (DataRowView drv in dv)
          {
  
  
  
              TBID.Text = drv["RecordID"].ToString();
              TBRecordTitle.Text = drv["RecordTitle"].ToString();
              TBRecordCreator.Text = drv["Name"].ToString();
  </code></pre>
  
  <p>This works fine for me.</p>
  
  <p>What I am having difficulty with is the assigning int data to a variable so that I can do some logic.</p>
  
  <p>I have tried</p>
  
  <pre><code>iRecordOrigin = 1;
  iRecordOrigin = drv.GetValue&lt;int&gt;("RecordOriginID");
  iRecordOrigin = drv["RecordOriginID"];
  </code></pre>
  
  <p>But either intellisense complains and I know I am doing something wrong or i get a compiler/runtime error.</p>
  
  <p>How do I assign a field from the DataRowView to a variable?</p>
  
  <p>I would like to know this for an:</p>
  
  <p>Integer
  String
  and
  Date</p>
  
  <p>datatypes</p>
  
  <p>I have tried using casting, but have not had any joy.</p>
  
  <p>Regards</p>
  
  <p>Sam</p>