一聚教程网:一个值得你收藏的教程网站

热门教程

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

时间:2022-07-02 12:11:53 编辑:袖梨 来源:一聚教程网

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";

热门栏目