목록Programming (67)
분노의 챔질
OpenFileDialog openFileDlg = new OpenFileDialog(); openFileDlg.Filter = "Excel파일|*.xl*"; if (openFileDlg.ShowDialog() == DialogResult.OK) { txtFileName.Text = openFileDlg.FileName; var connectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=""Excel 12.0 Xml;HDR=YES"""; using (OleDbConnection con = new OleDbConnection(string.Format(connectionString, openFileDlg...
MailMessage message = new MailMessage(); string mailFrom = "보내는양반메일주소"; MailAddress from = new MailAddress(mailFrom); message.From = from; message.Subject = "제목"; message.IsBodyHtml = true; message.Body = "내용"; message.To.Add("받는양반메일주소"); Attachment data = new Attachment(@"첨부파일명"); message.Attachments.Add(data); var objMail = new SmtpClient("메일서버주소", 25); objMail.UseDefaultCredentials = false; o..
MSDN : http://msdn.microsoft.com/ko-kr/library/bb397676.aspx LINQ를 사용시 using 추가 using System.Linq; 에서의 LINQ DataTable dt = new DataTable(); dt.Columns.Add("Id", typeof(int)); dt.Columns.Add("Name", typeof(string)); dt.Rows.Add(1, "홍길동"); dt.Rows.Add(2, "이순신"); dt.Rows.Add(3, "세종대왕"); var qry = from q in dt.AsEnumerable() where q.Field("Name") == "홍길동" select q; foreach (var row in qry) { Message..
Xml파일을 하나 만든다. Visual Studio 명령프롬프트를 실행하여 아래와 같이 스키마파일과 cs파일을 만들어준다 프로젝트에 만들어진 xsd와 cs파일을 추가한다. XML파일 읽기 SkinMap map; using (Stream stream = new FileStream(@"SkinMap.xml", FileMode.Open, FileAccess.Read)) { XmlSerializer serializer = new XmlSerializer(typeof(SkinMap)); map = (SkinMap)serializer.Deserialize(stream); } foreach (var item in map.Skin) { listBoxControl1.Items.Add(item.SkinName); }
private void btnEncryption_Click(object sender, EventArgs e) { this.txtPassWord.Text = PasswordEncryption(); } private void btnDecryption_Click(object sender, EventArgs e) { this.txtPassWord.Text = DecryptString(txtPassWord.Text, "ABCD"); } private string PasswordEncryption() { string EncryptedPassword = string.Empty; EncryptedPassword = EncryptionManager.EncryptString(txtPassWord.Text, "ABCD");..
string connectionString = @"Server=서버명; user id=로그인ID; password=비밀번호; database=DATABASE이름; Integrated Security=true;"; //윈도우인증일때 사용 SqlConnection conn = new SqlConnection(connectionString); conn.Open(); string query = "Select * from dbo.Employee where EmployeeID = @EmployeeID"; SqlCommand command = new SqlCommand(query, conn); //StoredProcedure 사용 // SqlCommand command = new SqlCommand("dbo.up_S..
클래스라이브러리로 생성된 폼을 띄울때 사용 string assembly = "test.dll"; string classname = "test.Form1"; Assembly asm = Assembly.LoadFrom(assembly); object o = asm.CreateInstance(classname); var doc = (Form)o; Form frm = doc; frm.Tag = assembly; if (frm == null) return; frm .MdiParent = this; // MDI폼이 아닌 경우 frm .FormBorderStyle = FormBorderStyle.None; // 새로운 폼이나 frm .Dock = DockStyle.Fill; // 팝업으로 띄울때 삭제 frm .Sho..
PDF파일을 읽어와서 이미지로 보여주고 PDF페이지를 한방에 이미지로 저장 이미지를 PDF로~ 확대하면 거지같다... 첨부파일을 열면 예제소스와 PDFLibNet.dll, PdfSharp.dll 이 있다.. 참조에 추가해라.. 짧게쓰니 썰렁하구만...