可惜Microsoft.Jet.OLEDB.4.0
提供者不像提供者那样支持该Replace()
功能Microsoft.ACE.OLEDB.12.0
,否则对您来说会容易得多。
我认为您必须正常获取该Address
字段并使用辅助函数将其转换string
为您想要的格式,如下所示:
public string GetBrokenLines(string address){
return address.Replace("%","\r\n");
}
//instead of using the address directly, you just need to pass it into the GetBrokenLines
//method and get the expected result.
要使用适配器填充DataTable
,请尝试以下操作:
public static DataTable GetRefDrList(string typeofDr, bool display){
DataTable refDrListTable = new DataTable();
refDrListTable.RowChanged += Format;
//....
da.Fill(refDrListTable);
//....
}
bool suppressFormat;
private void Format(object sender, DataRowChangedEventArgs e){
if(suppressFormat) return;
suppressFormat = true;
e.Row["Address"] = e.Row["Address"].ToString().Replace("%","\r\n");
suppressFormat = false;
}