try
{
string connString = @"Data Source=VINODKUMAR;Initial Catalog=ShreeSankalp;Persist Security Info=True;User ID=sa;Password=1234567890";
using (SqlConnection sqlConn = new SqlConnection(connString))
{
string sqlQuery = @"SELECT * from Admission where AdmissionID='" + textBox1.Text + "'";
SqlCommand cnd = new SqlCommand(sqlQuery, sqlConn);
SqlDataAdapter da = new SqlDataAdapter(cnd);
DataTable studentdatabase = new DataTable();
da.Fill(studentdatabase);
var smallList = FeeDEposit.Select(c => new { c.Name, c.Age });
dataGridView1.DataSource = smallList;
dataGridView1.DataSource = new BindingSource(studentdatabase, null);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
MessageBox.Show("Please Enter Admission ID");
}
}

Sujeet SumanRank #790 · 2.9K reputationPosted Sep 23, 2015, 9:30 PM EDT
Supreeth JRank #2,205 · 639 reputationPosted Sep 23, 2015, 12:51 AM EDT
Sujeet SumanRank #790 · 2.9K reputationPosted Sep 23, 2015, 1:33 AM EDT
vinod jangir111 reputationPosted Sep 23, 2015, 7:54 PM EDT