To jackyhx(飞不动的侠):这句我以前试过不行。在执行时有word界面出来,但没有文字内容出来。我现在有点怀疑是不是我将word文档存入数据库的语句出来错误呢?现将语句贴出请帮看看,谢谢!
Dim upfile As HttpPostedFile
upfile = up_file.PostedFile
FileLength = upfile.ContentLength
Dim FileByteArray(FileLength) As Byte
Dim streamObject As Stream
streamObject = upfile.InputStream
streamObject.Read(FileByteArray, 0, FileLength)
Dim connImg_temp As New SqlConnection()
Dim strConn As String
connImg_temp.ConnectionString = "data source=(local);initial catalog=dotNetItem_Lesson;password=lovesong;user id=sa;workstation id=HEQINCHEN;packet size=4096"
strConn = "Insert Into img_temp(img) values(@Image)"
Dim commImg_temp As New SqlCommand()
commImg_temp.CommandText = strConn
commImg_temp.Connection = connImg_temp
commImg_temp.Parameters.Add("@Image", SqlDbType.Image, FileLength).Value() = FileByteArray
connImg_temp.Open()
commImg_temp.ExecuteNonQuery()
connImg_temp.Close()
Response.Write("OK!")
Dim upfile As HttpPostedFile
upfile = up_file.PostedFile
FileLength = upfile.ContentLength
Dim FileByteArray(FileLength) As Byte
Dim streamObject As Stream
streamObject = upfile.InputStream
streamObject.Read(FileByteArray, 0, FileLength)
Dim connImg_temp As New SqlConnection()
Dim strConn As String
connImg_temp.ConnectionString = "data source=(local);initial catalog=dotNetItem_Lesson;password=lovesong;user id=sa;workstation id=HEQINCHEN;packet size=4096"
strConn = "Insert Into img_temp(img) values(@Image)"
Dim commImg_temp As New SqlCommand()
commImg_temp.CommandText = strConn
commImg_temp.Connection = connImg_temp
commImg_temp.Parameters.Add("@Image", SqlDbType.Image, FileLength).Value() = FileByteArray
connImg_temp.Open()
commImg_temp.ExecuteNonQuery()
connImg_temp.Close()
Response.Write("OK!")
解决方案 »
- 如何用CheckBox选中GridView中的多行,然后对所选行中的值进行计算?
- VS2005调试出错
- 如何在页面生成时自动将TreeView展开到某一个节点?
- 超级难题:asp.net下如何调用进程外com服务器,大侠来帮忙,小虾来学习
- 怎样能够在DataGrid中添加一个自动产生的序号列?
- 100分请教找工作的难题!!!!
- 求解啊,关于获到目录下文件,然后分页显示的问题 100%结贴率
- 请教
- FCKeditor 已经解决,但是不能上传图片和flash??
- 帮帮忙呀,我得到的字符串是以!@#$%分隔的,有我该怎么分呢
- 如何编写程序!欢迎讨论!来者有分!
- 谁能告诉我通过上传文件的控件上传去掉文件有大小限制
比如一个GIF图形,通过文件上传后,在SERVER端读取PostedFile.ContentType可以得到"image/gif"内容。