Tag: load

C#

Load Picture into PictureBox from base64 String

  String ImageText = "blahblahblahblahblah=="; Byte[] bitmapData = new Byte[ImageText.Length]; bitmapData = Convert.FromBase64String(FixBase64ForImage(ImageText)); System.IO.MemoryStream streamBitmap = new System.IO.MemoryStream(bitmapData); Bitmap bitImage = new Bitmap((Bitmap)Image.FromStream(streamBitmap)); pictureBox1.Image = bitImage;   private String FixBase64ForImage(String Image) { try { System.Text.StringBuilder st = new System.Text.StringBuilder(Image, Image.Length); st.Replace("rn", String.Empty); st.Replace(" ", String.Empty); return st.ToString(); } catch (Exception ex) { return ""; } …

C#

Loading SQL Server data into DataTable

DataTable represents one table of in-memory data. SqlConnection Connection = null; String sql_server_ip_or_hostname ".."; String database_name = ".."; String username = ".."; String password = "..";   try { Connection = new SqlConnection( "Data Source=" + sql_server_ip_or_hostname + ";" + "Initial Catalog=" + database_name + ";" + "User Id=" + username + ";" + "Password=" …