だから私はExcelシートテーブルとmssqlテーブルを持っています.2つはLINQを使用してExcelテーブル列0(最初)とmssql列textfield2で結合されています. 英数字の値を結合するときに私が抱えている問題は、うまくいかないようです。値が数値の場合は機能します。
var adapter = new OleDbDataAdapter("SELECT * FROM [Sheet1$]", excconnectionstring);
var adapter2 = new SqlDataAdapter("SELECT * FROM Table1", sqlconnectionstring);
var ds = new DataSet();
adapter.Fill(ds, "excel");
adapter2.Fill(ds, "sql");
var excel = ds.Tables["excel"].AsEnumerable();
var esqel = ds.Tables["sql"].AsEnumerable();
var query = from exc in excel
from sql in esqel
where exc[0].ToString() == sql.Field<string>("textfield2")
select new
{
debnr = sql.Field<string>("debnr"),
bedrag = double.Parse(exc[5].ToString())/100,
description = DateTime.Parse(exc[7].ToString(), new CultureInfo("nl-NL")).ToString("MMM yyyy"),
text1 = exc[0].ToString(),
projectno = sql.Field<string>("textfield1"),
central = sql.Field<string>("CentralizationAccount").Trim()
};
編集:Excelシートで英数字の値を上に並べると、英数字が機能するようです。しかし、数値では機能しないという問題があります..