title: Retrieve data from database and show in detailsview
body: <p>I want to retrieve data from database on the current logged in SharePoint user and show it on a control in a detailsview. But I really don't know how to achieve that on the best way. This is a code I've tried but it shows <code>null</code>.</p>
  
  <pre><code>    protected void Page_Load(object sender, EventArgs e)
      {
          if(!IsPostBack)
          {
              GetEmployeeCv();
          }
      }
  
      private void GetEmployeeCv()
      {
          using (var db = new KnowItCvdbEntities())
          {
              SPWeb theSite = SPControl.GetContextWeb(Context);
              SPUser theUser = theSite.CurrentUser;
              string strUserName = theUser.LoginName;
  
              var theEmpl =(from p in db.EMPLOYEES
                            where p.username == strUserName
                           select p).FirstOrDefault();
  
              if(theEmpl != null)
              {
                  Image empImg = (Image)DetailsViewShowFullCv.FindControl("imageProfPic");
                  empImg.ImageUrl = theEmpl.image;                    
              }
          }            
      }
  </code></pre>
  
  <p>If I want to databind my detailsview like:</p>
  
  <pre><code>                Image empImg = (Image)DetailsViewShowFullCv.FindControl("imageProfPic");
                  empImg.ImageUrl = theEmpl.image;                    
  
                  DetailsViewShowFullCv.DataSource = ??;
                  DetailsViewShowFullCv.DataBind();
  </code></pre>
  
  <p>I don't really know how to do it. Anyone out there that can help me out?</p>