日期:2014-05-18  浏览次数:20741 次

求帮忙 如何用windows mobile6 发送手机上的图片到远程数据库
小弟 最近开发一个项目 用windows mobile6 (虽然已经过时,但项目要求),我做的部分是点击按钮,进入图片文件夹,选中一个图片,点击发送,发送到远程服务器。

大家说下思路,提供点webservice或思路啥的 ,小弟不胜感激,小弟刚进公司,希望能留个好印象,跪求大家啦!!!!

------解决方案--------------------
C# code
public Byte[] getphoto(string photopath) 
{ 
string str = photopath; 
FileStream file = new FileStream(str, FileMode.Open, FileAccess.Read); 
Byte[] bytBLOBData = new Byte[file.Length]; 
file.Read(bytBLOBData, 0, bytBLOBData.Length); 
file.Close(); 
return bytBLOBData; 
}//这是定义函数.. 

然后..就是将转换成二进制码的图片插入数据库中..下面是简单的也是重要的sql语句.. 
if (this.pictureBox1.Image != null) 
{ 
sql1 = sql1 + ",Photo"; 
sql2 = sql2 + ",bytBLOBData"; 
Byte[] bytBLOBData = getphoto(openFileDialog1.FileName); 
cmd.Parameters.Add(new OleDbParameter("jpeg", OleDbType.Binary, bytBLOBData.Length, ParameterDirection.Input, true, 0, 0, null, DataRowVersion.Default, bytBLOBData)); 
} 

接下来..是读取... 

string sql = "select photo from studentinfo where studentid = " + this.Tag.ToString(); 
OleDbCommand cmd = new OleDbCommand(sql, connection1); 
if (Convert.DBNull != cmd.ExecuteScalar()) 
pictureBox1.Image = Image.FromStream(new MemoryStream((Byte[])cmd.ExecuteScalar()));//读取长二进制为图片..