当前位置: 首页 > 图文教程 > 网络编程 > ASP.NET > 从SQL Server中读写大数据列。

ASP.NET
dotNET下面调用Access中存储过程的方法
DataSet 的 Merge 方法研究
C#中using关键字的使用
Visual C#程序设计技巧小结
Creating GUIDs in c#
C#覆盖虚接口
在C#中应用哈希表(Hashtable)
对C#泛型中的new()约束的一点思考
身份证15To18 的算法(C#)
ADO.NET的结构体系。
ADO.NET的DataSet和ADO的Recordset的比较
OpenGLStepbyS
.NET对软件安装的冲击
IsVS.NETreadyforenterprise?(1)
IsVS.NETreadyforenterprise?(5)
IsVS.NETreadyforenterprise?(6)
.Net和Java有何相似之处
Hi,现在我们暂时不谈Passport
替代System.Web.Mail的新类库(新增邮件列表功能)
C#和VB.NET的区别

ASP.NET 中的 从SQL Server中读写大数据列。


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 70 ::
收藏到网摘: n/a


/* Author:Wu Xiuxiang; Email:[email protected]
*/
public static void Main() { //写入大对象到SqlServer FileStream fs = new FileStream("C:\\test.bmp",FileMode.OPen,FileAccess.Read); BinaryReader br = new BinaryReader(fs); SqlConnection conn = new SqlConnection("server=localhost;uid=sa;pwd=sa;database=northwind"); string cmdText = "UPDATE EMPLOYEES" + "SET Photo=@image where EmployeeId=1"; SqlCommand cmd = new SqlCommand(cmdText,conn); cmd.Parameters.Add("@image",SqlDbType.Image); cmd.Parameters["@image"].Value = br.ReadBytes((int)br.BaseStream.Length); conn.Open(); int i=cmd.ExecuteNoQuery(); //从SQL Server中读取大对象 string cmdtext = "SELECT employeeid,photo" + " from employees where employeeid = 1"; SqlCommand cmd2 = new SqlCommand(cmdtext,conn);