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