try { string strConnString = ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString; SqlConnection con = new SqlConnection(strConnString); DataTable dt = new DataTable(); using (SqlConnection conn = new SqlConnection(strConnString)) { string strQuery = "SELECT * FROM TDLoanRate where LoanType Like'" + txtValue.Text + "%'"; SqlCommand cmd = new SqlCommand(strQuery); using (SqlDataAdapter sda = new SqlDataAdapter()) { cmd.Connection = con; conn.Open(); sda.SelectCommand = cmd; sda.Fill(dt); GridView2.DataSource = dt; GridView2.DataBind(); }
int count = dt.Rows.Count; // get the count
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)