C#数据转换实现代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace ExcelToTxt
{
public partial class Form1 : Form
{
private DataTable dt; //存储EXCLE中的数据
public Form1()
{
InitializeComponent();
this.btnChange.Enabled = false;//初始化设置控件为不可用
}
/// <summary>
/// 该方法打开一个Excel文件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnSelect_Click(object sender, EventArgs e)
{
string excelFilePath = ""; //存储打开的文件的路径
OpenFileDialog selectFile = new OpenFileDialog();
//选择打开的文件设置
selectFile.Filter = "Excel(*.xls)|*.xls";
selectFile.FilterIndex = 1;
selectFile.DefaultExt = "xls";
selectFile.AddExtension = true;
selectFile.RestoreDirectory = true;








