filmov
tv
Get Data from SQL Server to TextBox, Dropdown and RadioButton in Asp.Net c#.
Показать описание
Complete CRUD Operation in Asp.Net C# LINK
Get data from SQL to textbox
Get data from SQL to dropdown
Get data from SQL to Radiobuttonlist
Code-
SqlConnection con = new SqlConnection("Data Source=ROWSHAN-PC;Initial Catalog=ProgrammingDB;User ID=sa;Password=swfit129");
protected void Button5_Click(object sender, EventArgs e)
{
con.Open();
SqlCommand comm = new SqlCommand("select * from StudentInfo_Tab where StudentID= '" + int.Parse(TextBox1.Text) + "'", con);
SqlDataReader srd = comm.ExecuteReader();
while (srd.Read())
{
TextBox2.Text = srd.GetValue(1).ToString();
DropDownList1.SelectedValue = srd.GetValue(2).ToString();
TextBox3.Text = srd.GetValue(3).ToString();
TextBox4.Text = srd.GetValue(4).ToString();
RadioButtonList1.SelectedValue = srd.GetValue(5).ToString();
}
con.Close();
}
------
This channel covers all the programming tutorial related with .Net- C#, linq, VB, SQL, Android, HTML, CSS, jQuery, Crystal Report and Microsoft Report.
So, please subscribe and keep in touch.
Visit my page in Facebook
------
More Tags
#GetDataFromSQLToAsp_Net #DisplayDataFromSQLToTextBox #Asp_NetTutorial
Get data from SQL to textbox
Get data from SQL to dropdown
Get data from SQL to Radiobuttonlist
Code-
SqlConnection con = new SqlConnection("Data Source=ROWSHAN-PC;Initial Catalog=ProgrammingDB;User ID=sa;Password=swfit129");
protected void Button5_Click(object sender, EventArgs e)
{
con.Open();
SqlCommand comm = new SqlCommand("select * from StudentInfo_Tab where StudentID= '" + int.Parse(TextBox1.Text) + "'", con);
SqlDataReader srd = comm.ExecuteReader();
while (srd.Read())
{
TextBox2.Text = srd.GetValue(1).ToString();
DropDownList1.SelectedValue = srd.GetValue(2).ToString();
TextBox3.Text = srd.GetValue(3).ToString();
TextBox4.Text = srd.GetValue(4).ToString();
RadioButtonList1.SelectedValue = srd.GetValue(5).ToString();
}
con.Close();
}
------
This channel covers all the programming tutorial related with .Net- C#, linq, VB, SQL, Android, HTML, CSS, jQuery, Crystal Report and Microsoft Report.
So, please subscribe and keep in touch.
Visit my page in Facebook
------
More Tags
#GetDataFromSQLToAsp_Net #DisplayDataFromSQLToTextBox #Asp_NetTutorial
Комментарии