{"rsdb":{"rid":"244557","subhead":"","postdate":"0","aid":"168296","fid":"57","uid":"1","topic":"1","content":"
\u4eceOracle<\/a>\u6570\u636e\u5e93<\/a>\u4e2d\u8bfb\u51fa\u56fe\u7247<\/p> \n \u65b9\u6cd51\uff1a\u4ece\u6570\u636e\u5e93\u4e2d\u8bfb\u53d6\u6570\u636e\u5e76\u4ee5\u6587\u4ef6\u5f62\u5f0f\u4fdd\u7559\u5728\u670d\u52a1\u5668\u4e0a<\/p> \n \r\n Dim conn As New OracleClient.OracleConnection \r\n Dim cmd As New OracleClient.OracleCommand \r\n Dim myReader As OracleClient.OracleDataReader \r\n Dim sql As String \r\n Dim fl As File \r\n \r\n sql = "select * from news where newsid=3211" '\u4ece\u6570\u636e\u5e93\u4e2d\u53d6\u51fa\u56fe\u7247\u6570\u636e blob \r\n conn.ConnectionString = "Password=macro;User ID=gf;Data Source=site" \r\n cmd.CommandText = sql \r\n cmd.Connection = conn \r\n \r\n conn.Open() \r\n myReader = cmd.ExecuteReader(CommandBehavior.SequentialAccess) \r\n myReader.Read() \r\n \r\n Label1.Text = myReader("title") \r\n \r\n Dim fs As FileStream ' Writes the BLOB to a file (*.bmp). \r\n Dim bw As BinaryWriter ' Streams the binary data to the FileStream object. \r\n Dim bufferSize As Integer = 1000 ' The size of the BLOB buffer. \r\n Dim outbyte(bufferSize - 1) As Byte ' The BLOB byte() buffer to be filled by GetBytes. \r\n Dim retval As Long ' The bytes returned from GetBytes. \r\n Dim startIndex As Long = 0 ' The starting position in the BLOB output. \r\n Dim fpath As String \r\n \r\n '\u5c06\u56fe\u7247\u6570\u636e\u5b58\u6210\u672c\u5730\u6587\u4ef6 \r\n fpath = Server.MapPath(Request.ApplicationPath) & "\\Image\\photo.bmp" \r\n fs = New FileStream(fpath, FileMode.OpenOrCreate, FileAccess.Write) \r\n bw = New BinaryWriter(fs) \r\n \r\n ' Reset the starting byte for a new BLOB. \r\n startIndex = 0 \r\n \r\n ' Read bytes into outbyte() and retain the number of bytes returned. \r\n retval = myReader.GetBytes(2, startIndex, outbyte, 0, bufferSize) 'GetBytes\u8fd4\u56de\u5b57\u6bb5\u4e2d\u7684\u53ef\u7528\u5b57\u8282\u6570,\u7b2c\u4e00\u4e2a\u53c2\u6570\u4e3a\u4ece0\u5f00\u59cb\u7684\u5217\u5e8f\u53f7 \r\n \r\n ' Continue reading and writing while there are bytes beyond the size of the buffer. \r\n Do While retval = bufferSize \r\n bw.Write(outbyte) \r\n bw.Flush() '\u6e05\u7406\u5f53\u524d\u7f16\u5199\u5668\u7684\u6240\u6709\u7f13\u51b2\u533a\uff0c\u4f7f\u6240\u6709\u7f13\u51b2\u6570\u636e\u5199\u5165\u57fa\u7840\u8bbe\u5907\u3002 \r\n \r\n ' Reposition the start index to the end of the last buffer and fill the buffer. \r\n startIndex = startIndex + bufferSize \r\n retval = myReader.GetBytes(2, startIndex, outbyte, 0, bufferSize) \r\n Loop \r\n \r\n ' Write the remaining buffer. \r\n bw.Write(outbyte) \r\n bw.Flush() \r\n \r\n ' Close the output file. \r\n bw.Close() \r\n fs.Close() \r\n \r\n ' Close the reader and the connection. \r\n myReader.Close() \r\n conn.Close() \r\n \r\n Dim logo As Image '\u6587\u4ef6\u683c\u5f0f\u8f6c\u6362 \r\n logo = Image.FromFile(fpath) \r\n fpath = Server.MapPath(Request.ApplicationPath) & "\\Image\\zkjhy.jpeg" \r\n logo.Save(fpath, System.Drawing.Imaging.ImageFormat.Jpeg) \r\n \r\n 'Me.Image1.Width = New Unit(300) '\u8c03\u6574\u663e\u793a\u5927\u5c0f \r\n 'Me.Image1.Height = New Unit(350) \r\n Me.Image1.ImageUrl = "image\/zkjhy.jpeg" <\/pre> \n<\/div>","orderid":"0","title":"\u4eceOracle\u6570\u636e\u5e93\u4e2d\u8bfb\u51fa\u56fe\u7247\u7684\u65b9\u6cd5\uff08\u4ee3\u7801\u6559\u7a0b\uff09","smalltitle":"","mid":"0","fname":"\u6570\u636e\u5e93\u7f16\u7a0b","special_id":"0","bak_id":"0","info":"0","hits":"121","pages":"1","comments":"0","posttime":"2018-02-13 12:56:52","list":"1518497812","username":"admin","author":"","copyfrom":"","copyfromurl":"","titlecolor":"","fonttype":"0","titleicon":"0","picurl":"https:\/\/www.cppentry.com\/upload_files\/","ispic":"0","yz":"1","yzer":"","yztime":"0","levels":"0","levelstime":"0","keywords":"Oracle<\/A> \u6570\u636e\u5e93<\/A> \u8bfb\u51fa<\/A> \u56fe\u7247<\/A> \u65b9\u6cd5<\/A> \u4ee3\u7801<\/A> \u6559\u7a0b<\/A>","jumpurl":"","iframeurl":"","style":"","template":"a:3:{s:4:\"head\";s:0:\"\";s:4:\"foot\";s:0:\"\";s:8:\"bencandy\";s:0:\"\";}","target":"0","ip":"113.87.122.142","lastfid":"0","money":"0","buyuser":"","passwd":"","allowdown":"","allowview":"","editer":"","edittime":"0","begintime":"0","endtime":"0","description":"\u4eceOracle\u6570\u636e\u5e93\u4e2d\u8bfb\u51fa\u56fe\u7247\u7684\u65b9\u6cd5\uff08\u4ee3\u7801\u6559\u7a0b\uff09","lastview":"1712981534","digg_num":"0","digg_time":"0","forbidcomment":"0","ifvote":"0","heart":"","htmlname":"","city_id":"0"},"page":"1"}