ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ¶×¤JExcel¨ìDataGridView¦p¦ó³]©wUpdateCommand

[µo°Ý] ¶×¤JExcel¨ìDataGridView¦p¦ó³]©wUpdateCommand

³Ìªñ¾Ç¤F¤@­Ó¥i¥H§âExcel¶×¤JDataGridViewªºµ{¦¡,¥i¬O²{¦b·Q§âDataGridView½s¿è«áªº¤º®e§Q¥ÎButton2ªºClick¨Æ¥ó¦A¶Ç¦^ExcelÀx¦s
¼gªºClick¨Æ¥óµ{¦¡½X¦p¤U:
private void button2_Click(object sender, EventArgs e)
{
string ExcelPath = System.Windows.Forms.Application.StartupPath + @"\testexcel.xls";
string OpenExcelData = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source=" + ExcelPath + ";Extended Properties ='Excel 8.0;HDR=Yes;IMEX=2;ReadOnly=0'";
string OutputSheet = "Select * From [Sheet1$]";

OleDbConnection ExcelConnection = new OleDbConnection(OpenExcelData);

DataTable dTableOut = new DataTable();
DataSet dataset = new DataSet();
OleDbCommand ExCommendOut = new OleDbCommand(OutputSheet, ExcelConnection);
OleDbDataAdapter dataAdpter = new OleDbDataAdapter(ExCommendOut);
dataAdpter.Update(dTableOut);
}
¥i¬O°õ¦æ«áµo²{¨Ã¨S¦³Àx¦s¦¨¥\,°õ¦æ¸òÂIÀ»Button2®É³£¨Sµo¥Í°ÝÃD,¦ý´N¬O¨SÀx¦s§ó§ï¤º®e,
¤WºôGoogle¤@¤U,¦n¹³¬OExcelµLªk¥ÎdataAdpter.Update¨Ó°õ¦æ¦sÀÉ,­n¨Ï¥Î"UpdateCommand"
¦³¥ý¸ÕµÛ·j´M¤@¤U,ÁÙ¬OµLªk¼g¥XUpdateCommandµ¹OleDbDataAdapter¥Î
¦³«e½ú¯àÀ°§U¤@¤U¶Ü?¯à¤£¯à¼g­Ó¤p¤pªº½d¨Òµ¹¤p§Ì°Ñ¦Ò¤@¤U,·PÁ¦U¦ì«e½ú¤F

        ÀR«ä¦Û¦b : ¦³¤ß´N¦³ºÖ¡A¦³Ä@´N¦³¤O¡A¦Û³yºÖ¥Ð¡A¦Û±oºÖ½t¡C
ªð¦^¦Cªí ¤W¤@¥DÃD