static void Main() { string serverName = TrasenClasses.GeneralClasses.ApiFunction.GetIniString("SERVER_NAME", "NAME", Constant.ApplicationDirectory + "\\ClientConfig.ini"); if (serverName == "") { System.Windows.Forms.MessageBox.Show("ClientConfig.ini中[SERVER_NAME]的NAME未设置,请启动配置程序并设置当前服务器", "错误"); return; } //string filename = Constant.ApplicationDirectory + " \\" + string.Format("{0:yyyyMMdd}", DateTime.Now) + ".txt"; RelationalDatabase database = null; database = new MsSqlServer(); string connectionString = WorkStaticFun.GetConnnectionString(ConnectionType.SQLSERVER, serverName); database.Initialize(connectionString); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new FrmServer(database)); }
static void Main() { /* * 参数说明: * caption :主窗体标题 * connectionType : 数据库连接类型 * connectionString 连接字符串 * mainProgramname:主程序名 * checkRegister :是否检查注册信息 * */ string serverName = "mydb_svr"; serverName = TrasenClasses.GeneralClasses.ApiFunction.GetIniString("SERVER_NAME", "NAME", Constant.ApplicationDirectory + "\\ClientConfig.ini"); if (serverName == "") { System.Windows.Forms.MessageBox.Show("ClientConfig.ini中[SERVER_NAME]的NAME未设置,请启动配置程序并设置当前服务器", "错误"); return; } string connectionString = WorkStaticFun.GetConnnectionString(ConnectionType.SQLSERVER, serverName); TrasenMainWindow.FrmMdiMainWindow.StartupMain("创星科技信息系统", ConnectionType.SQLSERVER, connectionString, "Trasen", true); }
private void Import() { try { pb1.Minimum = 0; pb1.Value = 0; pb1.Maximum = 30; string connectionString_ly = WorkStaticFun.GetConnnectionString(ConnectionType.SQLSERVER, "来源"); string connectionString_mb = WorkStaticFun.GetConnnectionString(ConnectionType.SQLSERVER, "目标"); SqlConnection db_ly = new SqlConnection(connectionString_ly); db_ly.Open(); SqlCommand cmd = new SqlCommand("select * from zy_fee_speci where year(charge_date)=2012", db_ly); cmd.CommandTimeout = 1200; SqlDataReader sdr = cmd.ExecuteReader(); SqlBulkCopy bulkCopy = new SqlBulkCopy(connectionString_mb); //设置目标表名称 bulkCopy.DestinationTableName = "zy_fee_speci_2012"; bulkCopy.BulkCopyTimeout = 1200; //每导入1条数据就执行一次SqlRowsCopied方法 bulkCopy.NotifyAfter = 227327; bulkCopy.BatchSize = 227327; bulkCopy.SqlRowsCopied += new SqlRowsCopiedEventHandler(bulkCopy_SqlRowsCopied); bulkCopy.WriteToServer(sdr); } catch (System.Exception err) { MessageBox.Show(err.Message); } }