web应用程序
已知远程图片地址
以byte[]保存到数据库
已知远程图片地址
以byte[]保存到数据库
解决方案 »
- 问一下 C# 控制台程序 能调用 OCX 吗?
- vs2005 2349 错误! 我都重装系统了!还是没用!急~
- 用事务处理SqlDataAdapter的Update方法,我这么写哪错了?
- 求线性搜索最优算法
- 急求配合socket连接的iocp(完成端口)代码或者资料,200相送。
- 以前没有编写过此类文件,现在把程序需求写出来了,希望大家给些意见
- dev gridcontrol 单选框效果
- .net 提示输入字符串的格式不正确。为什么??
- 请各位帮我找一下textbox的name属性!(在一段代码中)
- 我的IE注册表被www.163123.com改了,怎么办!!!!!!!!!!!
- Operator 'and' incompatible with operand types 'Boolean' and 'String'
- asp.net C# 如何做日程提前三个月提醒
/// 保存图片内容
/// </summary>
/// <param name="strName">图片名称</param>
/// <param name="strPath">图片路径</param>
/// <param name="strDescription">图片说明</param>
/// <param name="strImage">图片内容</param>
private void SaveTable(string strName, string strPath,string strDescription,byte[] strImage)
{
try
{ using (SqlConnection conn = new SqlConnection("Data Source=192.168.0.21;Initial Catalog=Book Keeping;User ID=sa;Password=sa;Connection Timeout=60;"))
{
conn.Open();
SqlCommand comm = new SqlCommand();
string strSql = "Insert into PictureInfo(strName,strPath,strDescription,strImageContent) values (@Name,@Path,@Description,@Image)";
comm.CommandText = strSql;
comm.CommandType = CommandType.Text;
comm.Connection = conn;
comm.Parameters.Add("@Name",SqlDbType.VarChar);
comm.Parameters.Add("@Path",SqlDbType.VarChar);
comm.Parameters.Add("@Description",SqlDbType.VarChar);
comm.Parameters.Add("@Image",SqlDbType.Image); comm.Parameters[0].Value = strName;
comm.Parameters[1].Value = strPath;
comm.Parameters[2].Value = strDescription;
comm.Parameters[3].Value = strImage; comm.ExecuteNonQuery();
}
}
catch(Exception)
{
}
}