title: There is no row at position 0:c# code error
body: <pre><code>   DataRow dr = GetData("select * from Personal_det where Fid='" + va+"'").Rows[0];
      Document doc = new Document(PageSize.A4, 88f, 88f, 10f, 10f);
      Font NormalFont = FontFactory.GetFont("Arial", 12, Font.NORMAL, BaseColor.BLACK);
      using (System.IO.MemoryStream m = new System.IO.MemoryStream())
      {
          PdfWriter w = PdfWriter.GetInstance(doc, m);
          Phrase phrase = null;
          PdfPCell cell = null;
          PdfPTable table = null;
          BaseColor color = null;
          Paragraph para = null;
          Font times = null;
          BaseFont bfTimes = null;
  
  
          doc.Open();
          table = new PdfPTable(2);
  
          cell = PhraseCell(new Phrase("Faculty Profile", FontFactory.GetFont("Arial", 12, Font.UNDERLINE, BaseColor.BLACK)), PdfPCell.ALIGN_CENTER);
          //table.SpacingBefore = 20f;
  
          cell.Colspan = 2;
          table.AddCell(cell);
          cell = PhraseCell(new Phrase(), PdfPCell.ALIGN_CENTER);
          cell.Colspan = 2;
          cell.PaddingBottom = 30f;
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/J8kCd.png" alt="Error messsage">
  This is my C# code.When i try to execute it gives the following error</p>
  
  <p>I dont know from where i get the error,is it from code itself or the database.In some instance this code works,but for some instance it will give the following error..Can you clarify the error to me.?</p>
  
  <p>If i use dr.rows.length..It doesnt shows the row keyword<img src="https://i.stack.imgur.com/7eXa4.png" alt="No row keyword shown "></p>
  
  <pre><code>    private DataTable GetData(string query)
        {
      string conString =                              
       ConfigurationManager.ConnectionStrings["ProjectConnectionString"].ConnectionString;
      SqlCommand cmd = new SqlCommand(query);
      using (SqlConnection cn = new SqlConnection(conString))
      {
          using (SqlDataAdapter da = new SqlDataAdapter())
          {
              cmd.Connection = cn;
              da.SelectCommand = cmd;
              using (DataTable dt = new DataTable())
              {
                  da.Fill(dt);
                  return dt;
              }
  
  
          }
      }
  
  
  }
  </code></pre>
  
  <p>This is the Getdata method..previously i had FID as string but now converted into varchar,I am struggling to get the right answer,please help to rebuild my code</p>