my tx开发者_开发问答t file containt
empno name salary 101 lekha 20000 102 hema 30000
i want to change the salary of 102-hema , is this possible to change? .how to change.
again i want to store,retrieve,update data into excel using C# console application
using System;
using System.Data;
using System.Data.OleDb;
using System.Collections.Generic;
using System.Text;
namespace Excelcalling1
{
class Program
{
static void Main(string[] args)
{
string F1Name = "C:\\Documents and Settings\\origin\\Desktop\\New Folder\\Book1.xls";
string CnStr = ("Provider=Microsoft.Jet.OLEDB.4.0;" + ("Data Source="
+ ( F1Name + (";" + "Extended Properties=\"Excel 8.0;\""))));
DataSet ds = new DataSet();
OleDbDataAdapter DA = new OleDbDataAdapter("Select * from [Sheet1$]", CnStr);
Console.WriteLine("File Accessed!!!!");
try
{
DA.Fill(ds, "srlno");
foreach (DataRow dr in ds.Tables["srlno"].Rows)
{
Console.WriteLine(dr["A"] + "\t" + dr["B"] + "\t" + dr["C"]);
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
Console.ReadLine();
}
}
}
Either you can import that into excel and query this information. Or there is a txt odbc driver you can use that look @ http://www.c-sharpcorner.com/UploadFile/mahesh/AccessTextDb12052005071306AM/AccessTextDb.aspx
精彩评论