private void Form6_Load(object sender, EventArgs e) { All.Data.SqlServer sql = new All.Data.SqlServer(); sql.Login("192.168.0.100", "HaiXinIndoor", "sa", ""); All.Window.DataBackUp back = new All.Window.DataBackUp(sql); back.Show(); }
private void Form2_Load(object sender, EventArgs e) { All.Data.SqlServer sq = new All.Data.SqlServer(); string sql = ""; Dictionary <string, string> buff = new Dictionary <string, string>(); buff.Add("Address", "10.46.1.42"); buff.Add("DataBase", "Main"); buff.Add("UserName", "sa"); buff.Add("Password", "123456"); if (sq.Login(buff)) { using (DataTable dt = sq.Read("select * from tb_dp where LineName='G3'")) { if (dt != null && dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { sql = "'通用'"; for (int j = 1; j < 20; j++) { switch (j) { case 3: case 6: case 7: case 11: case 12: sql = string.Format("{0},", sql, dt.Rows[i][j]); break; default: sql = string.Format("{0},'", sql); break; } sql = string.Format("{0}{1}", sql, dt.Rows[i][j]); switch (j) { case 3: case 6: case 7: case 11: case 12: break; default: sql = string.Format("{0}'", sql); break; } } if (sq.Write(string.Format("insert into tb_dp values ({0})", sql)) <= 0) { } } } } } }