Last post Jun 02, 2013 10:53 PM by Jamobor yao - MSFT
May 30, 2013 05:44 AM|akshitbansal|LINK
I have designed a page using inline programming that is using strbuild.append.
I have declared strings which i want to be fetched from the database.
Eg. String address ="";
i want address from the database.
Please tell me about it including establishing the connection as well
May 31, 2013 01:24 AM|Jamobor yao - MSFT|LINK
you need to connect with sql,then get the variables you want.
take a look at the following link.
Hope it can help you
May 31, 2013 01:46 AM|akshitbansal|LINK
Thank you , it helped me a lot.
But can you give me an example based on the what i mentioned in my thread.
If i select address from database then how can i bind it to the address string.
This will clear my query.
Jun 02, 2013 10:53 PM|Jamobor yao - MSFT|LINK
you can try such as the following code
SqlConnection conn = new SqlConnection(GetConnectionString());
string qury = "select Emp_id,Password from loginuser where (name=@Emp_id) and (Password=@Password)";
SqlCommand cmd = new SqlCommand(qury, conn);
DataTable dt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter(cmd);
if (dt.Rows.Count >= 0)
string address = dt.Rows["address"].ToString();
you may attention following points.
1).GetConnectionString() that return your database connection;
2).qury is your sqlcommand and you can user yours.
Hope it will help you