string str = @"INSERT INTO SEOrderEntry (FInterID,FEntryID,FBrNo,FMapNumber,FMapName,FItemID,FBarCode,FAuxPropID,FQty,FUnitID,
Fauxqty,FStockQtyOnlyForShow,FEntrySelfS0172,FEntrySelfS0174,FEntrySelfS0173,FComplexQty,FSecCoefficient,FSecQty,FICPrcPly_FName,Fauxprice,
FAuxTaxPrice,Famount,FCess,FTaxRate,FUniDiscount,FTaxAmount,FAuxPriceDiscount,FTaxAmt,FAllAmount,FTranLeadTime,
FInForecast,FDate,Fnote,FPlanMode,FMTONo,FBomInterID,FCostObjectID,FAdviceConsignDate,FATPDeduct,FLockFlag,
FSourceBillNo,FSourceTranType,FSourceInterId,FSourceEntryID,FMrpTime,FContractBillNo,FContractInterID,FContractEntryID,FAuxQtyInvoice,FQtyInvoice,
FSecInvoiceQty,FSecCommitInstall,FOrderBillNo,FOrderEntryID,FCommitInstall,FAuxCommitInstall,FAllStdAmount,FMrpLockFlag,FHaveMrp,FReceiveAmountFor_Commit,
FTplExtendKey1,FBuyerFreight,FIsGift,FIsExchangePoint,FExchangePoints,FGroupID,FParentID,FEntrySelfS0175,FEntrySelfS0176,FEntrySelfS0177,
FEntrySelfS0180,FEntrySelfS0181,FEntrySelfS0182,FEntrySelfS0183,FEntrySelfS0184,FEntrySelfS0185,FEntrySelfS0186,FEntrySelfS0187)
VALUES (9670,1,'0','','',40222,'',0,123,249,
123,0,0,0,0,'123扎',0,0,'',12,
13.56,1476,13,0,0,0,13.56,191.88,1667.88,'',
0,'2020-04-11','',14036,'',0,'0','2020-04-11',0,0,
'',0,0,0,Null,'',0,0,0,0,
0,0,'','',0,0,1667.88,0,0,0,
'',0,0,0,0,'','','','','',
'项目编号','项目名称',10,'2020-04-11','品磊编号','项目类型','框架协议号','技术协议号') ";
str = Regex.Replace(str, @"[\r\n]", "");
str = Regex.Replace(str, @"[\s*]", "");
string a= MidStrEx(str, "(", ")");
string b = MidStrEx(str, "VALUES(", ")");
string table= MidStrEx(str, "INSERTINTO", "(");
string[] c = a.Split(',');
string[] d = b.Split(',');
string classPr = "public class " + table + "\r\n{";
string objvalues = " " + table + " " + table + " = new " + table + "();\r\n";
//foreach (var item in c)
//{
// classPr = classPr + "public string " + item + " {get;set;}\r\n";
//}
for (int i = 0; i < c.Length; i++)
{
if (d[i].Contains("'"))
{
classPr = classPr + "public string " + c[i] + " {get;set;}\r\n";
}
else
{
classPr = classPr + "public double " + c[i] + " {get;set;}\r\n";
}
}
classPr = classPr + "}";
for (int i = 0; i < c.Length; i++)
{
if (d[i].Contains("'"))
{
objvalues = objvalues + " "+table+"." + c[i] + " = \"" + d[i] + "\";\r\n";
}
else
{
objvalues = objvalues + " " + table + "." + c[i] + " = " + d[i] + ";\r\n";
}
}
目前就用类double类型和string类型,自己需求可以进行优化