var sqlconn = ConfigurationManager.ConnectionStrings["SQLConnStringRead"].ConnectionString;
string sql = "select * from TicketRecord where 1=2";
//Database db = new Database(sqlconn);
//var ds = db.QueryExtend(sql); DataTable ImportDT = SqlHelper.ExecuteDataTable(SqlHelper.SQLConnStringRead, CommandType.Text, sql);
for (int i = ; i <= count; i++)
{
DataRow dr = ImportDT.NewRow();
var tn = "SK".PadRight( - i.ToString().Length, '') + i;
dr["TicketNumber"] = tn;
dr["SceneryId"] = ;
dr["SceneryName"] = "";
dr["EnterpriseId"] = ;
dr["EnterpriseName"] = "";
dr["BatchNumber"] = "";
dr["SerialId"] = "";
dr["ParentId"] = ;
dr["TicketClassId"] = ;
dr["TicketClassName"] = "";
dr["TicketTypeId"] = ;
dr["TicketTypeName"] = "";
dr["RetailPrice"] = ;
dr["Discount"] = ;
dr["PeopleCount"] = ;
dr["TotalAmount"] = ;
dr["RefundPackageNum"] = ;
dr["RefundNum"] = ;
dr["RefundAmount"] = ; dr["FreePersonCount"] = ;
dr["ValidStartTime"] = "2015-08-12";
dr["ValidEndTime"] = "2015-08-12";
dr["SaleDate"] = "2015-08-12";
dr["UseNumber"] = ;
dr["HasCheckedNum"] = ;
dr["PayType"] = ;
dr["PayStatus"] = ;
dr["TicketStatus"] = ;
dr["DrawWay"] = ;
dr["PrintType"] = ;
dr["PackageNum"] = ;
dr["HostName"] = "";
dr["RowStatus"] = ;
dr["CreatorId"] = ;
dr["CreateBy"] = "";
dr["CreateOn"] = "2015-08-12";
dr["UpdateId"] = ;
dr["UpdateBy"] = "";
dr["UpdateOn"] = "2015-08-12";
dr["Prefix"] = "";
dr["Postfix"] = "";
dr["MidNum"] = "";
dr["Remark"] = "";
dr["BookMobile"] = "";
dr["ActivateDate"] = "2015-08-12";
dr["InsidePrice"] = ; ImportDT.Rows.Add(dr);
}
SqlConnectionStringBuilder sqlcsb = new SqlConnectionStringBuilder();
sqlcsb.ConnectionString = ConfigurationManager.ConnectionStrings["SQLConnStringRead"].ConnectionString;
SqlConnection SqlConn = new SqlConnection(sqlcsb.ConnectionString);
SqlConn.Open();
SqlBulkCopy bulkCopy = new SqlBulkCopy(SqlConn); ;
bulkCopy.BatchSize = count;
bulkCopy.BulkCopyTimeout = ;
bulkCopy.DestinationTableName = "TicketRecord";
bulkCopy.WriteToServer(ImportDT);
bulkCopy.Close();
SqlConn.Close();
05-06 05:09