protected void Page_Load(object sender, EventArgs e) { string strHostName = System.Net.Dns.GetHostName(); string clientIPAddress = System.Net.Dns.GetHostAddresses(strHostName).GetValue(0).ToString();
string strcon = "Data Source="; strcon += clientIPAddress+";" + "Initial Catalog=POS;Trusted_connection=true";
SqlConnection con = new SqlConnection(strcon); SqlCommand cmd = new SqlCommand("select * from AllTransactions where BranchKey=" + Convert.ToInt32(Session["BranchKey"]) + "", con);
SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds, "tt"); GridView1.DataSource = ds.Tables["tt"]; GridView1.DataBind(); }