hi iam using asp.net with c#
in my application when user login successfully,then in the next page based on the client database i have to display data in a grid view ,
so how to give connection string in asp.net with c#
can you correct my code which helps me
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(); }
|
the data is displaying in my system but when client logins it is showing no record, can you correct my code