nitish rai

nitish rai

  • NA
  • 319
  • 18.5k

how to data bind from store procedure and data display in

Dec 15 2017 7:10 AM
how to data bind from store procedure and data display in tex box
Please help me.
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
MyLabel.Text = DateTime.Now.ToString("00:01:10 tt");
MyLabel.Visible = false;
}
string connect = ConfigurationManager.ConnectionStrings["demoConnectionString"].ConnectionString;
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["demoConnectionString"].ConnectionString);
con.Open();
SqlDataReader myReader = null;
SqlCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "GetProcreatePossimate";
DataTable dt = new DataTable();
myReader = cmd.ExecuteReader();
while (myReader.Read())
{
TextBox1.Text = (myReader["Active Power KW"].ToString());
TextBox2.Text = (myReader["Power Factor"].ToString());
TextBox3.Text = (myReader["Current Amp"].ToString());
TextBox4.Text = (myReader["Voltage V"].ToString());
TextBox5.Text = (myReader["Frequency Hz"].ToString());
}
con.Close();
}
code is not work. 
 

Answers (2)