private void GetData() { SqlDataAdapter da = new SqlDataAdapter("Select IPAddress,CountryName as [Country Name],CityName as [City Name],Latitude,Longitude,Visiting_Date as [Visiting Date] from Locations where CityName='" + drp_cities.SelectedItem.Text + "' ORDER BY Visiting_Date DESC ", con); DataSet ds = new DataSet(); da.Fill(ds, "Locations"); Grid_Log.DataSource = ds; Grid_Log.DataMember = "Locations"; Grid_Log.DataBind(); int cnttb = ds.Tables["Locations"].Rows.Count; Label1.Text = cnttb.ToString(); }
private void GetData() { try { SqlDataAdapter da = new SqlDataAdapter("Select Page,Count from tbl_Pagecnt", con); DataSet ds = new DataSet(); da.Fill(ds, "tbl_Pagecnt"); Grid_Log.DataSource = ds; Grid_Log.DataMember = "tbl_Pagecnt"; Grid_Log.DataBind(); int cnttb = ds.Tables["tbl_Pagecnt"].Rows.Count; } catch (Exception) { } }