2
SqlConnection con = new SqlConnection();
con.ConnectionString = ConfigurationManager.ConnectionStrings["CN"].ConnectionString;
string query = "select * from Product";
SqlDataAdapter adp = new SqlDataAdapter(query, con);
DataSet ds = new DataSet();
adp.Fill(ds);
if (ds.Tables[0].Rows.Count > 0)
{
lblClient.Enabled = true;
lblClient1.Enabled = true;
lblClient2.Enabled = true;
lblClient3.Enabled = true;
lblClient.Text = ds.Tables[0].Rows[0].Field("P_Name");
lblClient1.Text = ds.Tables[0].Rows[1].Field("P_Name");
lblClient2.Text = ds.Tables[0].Rows[2].Field("P_Name");
lblClient3.Text = ds.Tables[0].Rows[3].Field("P_Name");
}
0
Thanks
0
Hi,
I wanted to get the sequence value in to the text box while inserting the values in to the database.
I have a customer table while inserting the details of the customer through client side i need to display the seq id of the cusomter after submitting the details.
0
Hi
DataTable dt = new DataTable();
-- fill datatable
if (dt.Columns.Count > 0)
{
for (int i = 0; i < dt.Columns.Count; i++)
{
if (dt.Columns[i].ColumnName != null)
{
string columnname = Convert.ToString(dt.Columns[i].ColumnName);
}
}
}
0
Firstly establish a connection
SqlConnection con=new SqlConnection("urconnectionstring");
SqlCommand cmd=new SqlCommand("select query to retrieve the label value",con);
con.open();
SqlDataAdapter da=new SqlDataAdapter();
da.SelectCommand=cmd;
Dataset ds=new DataSet();
da.Fill(ds);
Label1.Text=ds.Tables[0].Rows[0]["Coulmnname"].ToString();