Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. continuation od Databinding

continuation od Databinding

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netdatabasedesignsysadmin
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kal13na13
    wrote on last edited by
    #1

    public class WebForm5 : System.Web.UI.Page { protected System.Web.UI.WebControls.RadioButtonList Radiobuttonlist1; protected System.Web.UI.WebControls.Button Button1; protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1; protected System.Web.UI.WebControls.Label Label2; protected System.Web.UI.WebControls.DataGrid DataGrid1; protected System.Web.UI.WebControls.Label Label1; private void Page_Load(object sender, System.EventArgs e) { if(!Page.IsPostBack) { Collections(); } } void Collections() { SqlConnection con=new SqlConnection("server=KHWA73R;database=NorthWind;user id=sa;password=sa"); SqlCommand cmd=new SqlCommand("Select TOP 10 CustomerID,CompanyName from Customers order by CompanyName ",con); SqlDataAdapter adpater =new SqlDataAdapter(cmd); DataSet sets=new DataSet(); try { con.Open(); adpater.Fill(sets); Radiobuttonlist1.DataSource =cmd.ExecuteReader(); Radiobuttonlist1.DataBind(); DataGrid1.DataBind(); } catch(InvalidOperationException ioe) { Console.WriteLine("Exception in the reader " + ioe.StackTrace); } catch(NullReferenceException nre) { Console.WriteLine("exception in null" + nre.ToString()); } finally { con.Close(); } } // Put user code to initialize the page here #region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); } /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.Button1.Click += new System.EventHandler(this.Button1_Click); this.Load += new System.EventHandler(this.Page_Load); } #endregion private void Button1_Click(object sender, System.EventArgs e) { SqlConnection conn=new SqlConnection("server=KHWA73R;database=NorthWind;user id=sa;password=sa"); string strSelect=("SELECT CustomerID,OrderID FROM Orders" + " WHERE CustomerID = 'VINET' " + Radiobuttonlist1.SelectedItem.Value + "ORDER BY OrderID"); SqlCommand mycmd=new SqlCommand(strSelect,conn); //SqlDataReader readers=new SqlDataReader(mycmd); try { conn.Open(); // readers=mycmd.ExecuteReader(); DataGrid1.D

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups