mysql中的longblob类型处理
longblob 对应的 C#数据类型为 byte[]
1.byte[] 与 string 之间的转换
byte[] bb = Encoding.UTF8.GetBytes(ss);
string s = Encoding.UTF8.GetString(bb);
2.byte[] 与 image 之间的转换
//参数是图片的路径
public byte[] GetPictureData(string imagePath)
{
FileStream fs = new FileStream(imagePath, FileMode.Open);
byte[] byteData = new byte[fs.Length];
fs.Read(byteData, , byteData.Length);
fs.Close();
return byteData;
}
//将Image转换成流数据,并保存为byte[]
public byte[] PhotoImageInsert(System.Drawing.Image imgPhoto)
{
MemoryStream mstream = new MemoryStream();
imgPhoto.Save(mstream, System.Drawing.Imaging.ImageFormat.Bmp);
byte[] byData = new Byte[mstream.Length];
mstream.Position = ;
mstream.Read(byData, , byData.Length); mstream.Close();
return byData;
}
public static BitmapImage ByteArrayToBitmapImage(byte[] byteArray)
{
BitmapImage bmp = null;
try
{
bmp = new BitmapImage();
bmp.BeginInit();
bmp.StreamSource = new MemoryStream(byteArray);
bmp.EndInit();
}
catch
{
bmp = null;
} return bmp;
}
mysql中的longblob类型处理的更多相关文章
- Mysql中的一些类型
列类型--整数类型Tinyint:迷你整形 一个字节=8位 最大能表示的数值是0-255 实际区间 -128~127Smallint:小整形 两个字节 能表示0-65535Mediumint:中整型 ...
- 解析MySQL中存储时间日期类型的选择问题
解析MySQL中存储时间日期类型的选择问题_Mysql_脚本之家 https://www.jb51.net/article/125715.htm 一般应用中,我们用timestamp,datetime ...
- 关于MySql中的varchar类型
今天新开始的项目在做数据库设计,发现自己对MySql的varchar类型还不熟悉,故又上网收集资料整理如下. 1.varchar类型的变化 MySQL 数据库的varchar类型在4.1以下的版本中的 ...
- MySql中的varchar类型
转载:http://www.cnblogs.com/doit8791/archive/2012/05/28/2522556.html 1.varchar类型的变化 MySQL 数据库的varchar类 ...
- mysql中的timestamp类型时间比较:unix_timestamp函数
在mysql中,某字段的类型设置为了timestamp,那么我们现在希望取出指定时间段的记录,该如何做呢? 在php中有time()和strtotime()来进行日期和时间戳的格式化,而在mysql中 ...
- MySql中的时间类型datetime,timestamp,date,year比较
MySQL日期类型.日期格式.存储空间.日期范围比较.日期类型 存储空间 日期格式 日期范围------------ --------- ...
- MySQL 中的数字类型
MySQL 中数据类型常用的就三大类: 数字类型/numeric types 日期和时间/date and time types 字符类型/string (character and byte) ty ...
- MySQL中的JSON类型
前言(废话) 昨天抽了点时间在网上搜列了一个开源项目,项目挺完整的,前后台分离还带有微信小程序,我Clone下代码,经过一番倒腾,嘿~还真就跑起来了.在这个过程中,体验了一把VUE项目工程细节,因为之 ...
- 向mysql中插入Date类型的数据
先看数据库表的定义 date字段为sql.date类型.我要向其中插入指定的日期和当前日期. 一.插入当前日期 思路:先获取当前系统,在将当前系统时间转换成sql类型的时间,然后插入数据库.代码如下 ...
随机推荐
- axis1调用方式
axis http://10.15.22.28/itfmgr/services/ITaxManagement?wsdl package com.isoftstone.core.service.impl ...
- setInterval和setTimeout调用方法小知识科普
function a() { alert('hello'); } setInterval(a, ); setInterval(a(), ); setInterval(); setInterval(); ...
- JQuery中attr ,html,text,val,的一些用法
attr:主要获取元素内部的属性,返回 的是属性值 html:返回当前元素(不包括他自己本身的标签,但是可以返回他自己的)的标签加上内容.仅限于返回第一个. text:和 .html() 方法不同, ...
- Android 保存联系人,包括部门\职位\传真\地址\照片
private void toSaveContactInfo() { ContentValues values = new ContentValues(); // 首先向RawContacts.CON ...
- jquery ajax 序列化表单传参提交实体对象到后台action
========action后台我这里使用的是SpringMVC如果用ssh用法一致=============== @Controller@RequestMapping("PubjobCon ...
- ios实用wifi分析仪——AirPort
AirPort(wifi分析仪) android系统上免费的wifi分析仪很多,但是当我在AppStore上搜索时,找了半天也没找到想要的,后来还是问前辈才知道一款非常好用的app——AirPort, ...
- IE=EmulateIE8和IE=IE8的区别
IE=8<meta http-equiv="X-UA-Compatible" content="IE=8" />This forces IE 8 t ...
- HttpRequest Get Post,WebClient Get
#region HttpRequestGet public string HttpRequestGet(string url) { return HttpRequestGet(url, WebRequ ...
- PLSQL中便捷的输入
我们可以利用PLSQL工具中的替换功能进行sql语句的输入,具体做法如下: 工具---首选项---用户界面---编辑器 1. 然后点击“edit”按钮: 2. . 在文本框中输入你想要替换的字符,等号 ...
- Function.caller
https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Function/caller 非标准 ...