东方兄,我搞定了,看代码

作者:袖梨 2022-07-02
public void DataGrid1_Edit(object sender,DataGridCommandEventArgs e)
        {       
       string strSql;
       string ConnectionString;
       ConnectionString = ConfigurationSettings.AppSettings["ConnectionString"];
       DataGrid1.EditItemIndex =(int)e.Item.ItemIndex;    
       BindGrid();              
       DropDownList ddl = (DropDownList)(DataGrid1.Items[e.Item .ItemIndex].Cells [4].Controls [1]);
       strSql = "select WorkState,ItemNumber from ASP_Temp";    
       OleDbConnection myconn=new OleDbConnection(ConnectionString );
       OleDbCommand mycommand=new OleDbCommand (strSql,myconn);    
       myconn.Open();       
       OleDbDataReader myreader=mycommand.ExecuteReader();
           
       ddl.DataSource =myreader;
       ddl.DataTextField ="WorkState";

相关文章

精彩推荐