C#綁定數據


1.<asp:DropDownList

<asp:DropDownList ID="ddlclientType" runat="server" Width="140px" OnSelectedIndexChanged="ddlclientType_SelectedIndexChanged"
AutoPostBack="True">
</asp:DropDownList>

ListItem li = new ListItem();

li.Text = "-請選擇-";
li.Value = "0";

dsAccount = new DataSet();
dsAccount = SqlHelper.GetDataSet(sql, "Table1", null); //string sql=select AccountTypeID,AccountType from ******

ddlclientType.DataSource = dsAccount;
ddlclientType.DataTextField = "AccountType";
ddlclientType.DataValueField = "AccountTypeID";
ddlclientType.DataBind();
ddlclientType.Items.Insert(0, li);

  

2.Winform :dataGridView

SQLiteDataAdapter Slda = new SQLiteDataAdapter("select  ***,str)//
                DataTable Dt = new DataTable();
                Slda.Fill(Dt);
                dataGridView1.DataSource = Dt;

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM