title: How to get the primary key of the last row inserted into the table
body: <p>I am using multiview index to insert the news details. In the first view the user can enter details of news which is then inserted into db on clicking the next button
  the second view gives a user to add images of that news (only 3 images allowed) , </p>
  
  <p>what I am having problem is that the first view inserts data into the table dbo.newsdetail with a primary key
  newsID , while the second view should add the respected images using that newsId of the news just added into newsimages table. I just dont know how to get the newsID of the details
  which is added in the first view as news Id is working as a foreign key for the both the table. Any help or suggestions will be highly appreciated . </p>
  
  <pre><code> static public void insertNews(string newsDescription, string newsImage, string newsTitle)
  {
      SqlConnection conn = new SqlConnection(ConnectionString);
      conn.Open();
      SqlCommand insertNews = new SqlCommand("Insert INTO caravanNews(newsDescription, newsImage, newsTitle) VALUES ('" + newsDescription + "', '" + newsImage + "' , '" + newsTitle + "')",conn);
      insertNews.ExecuteNonQuery();
      conn.Close();
  
  }
  </code></pre>