protected void Page_Load(object sender, EventArgs e) { DataTable dt = new DataTable(); String strConnString = "Data Source=\\SqlExpress;Initial Catalog=HRDB;User ID=sa;"; SqlConnection con = new SqlConnection(strConnString); SqlDataAdapter sda = new SqlDataAdapter(); SqlCommand cmd = new SqlCommand("tblemployee"); cmd.CommandType = CommandType.Text; cmd.CommandText = sqlquery;
cmd.Connection = con; sda.SelectCommand = cmd; sda.Fill(dt); gvProducts .DataSource = dt; gvProducts .DataBind(); }
|