yaya1899

yaya1899

  • NA
  • 12
  • 0

How to add a new row or column in DataGrid?

Jan 2 2005 11:55 AM
Hi, im using datagrid to read data from excel file, after data binding, how can i add a new row or a new col into the datagrid ? Here is my code to read data from excel, -------------------------------------------------------------------------------------------------------- using System.Data.OleDb; string strCon = " Provider = Microsoft.Jet.OLEDB.4.0 ; Data Source = c:\\Test.xls;Extended Properties=Excel 8.0"; OleDbConnection myConn = new OleDbConnection(strCon); string strCom = " SELECT * FROM [Sheet1$] "; myConn.Open(); OleDbDataAdapter myCommand = new OleDbDataAdapter(strCom , myConn); DataSet inputDataSet = new DataSet(); myCommand.Fill (inputDataSet, "[Sheet1$]"); myConn.Close(); dtg_input.DataMember= "[Sheet1$]"; dtg_input.DataSource = inputDataSet; ---------------------------------------------------------------------------------------------------------

Answers (1)