How to store graphic images in SQL2000

xiaoxiao2021-03-06  157

Create Procedure SP_TextCopy (@srvname varchar (30), @login varchar (30), @Password varchar (30), @dbname varchar (30), @colname varchar (30), @filename varchar ( 30), @whereclause varchar (40), @direction char (1)) as declare @exec_str varchar (255) SELECT @EXEC_STR = 'TextCopy / s' @srvname '/ u' @login '/ p' @Password '/ d' @dbname '/ t' @TBNAME '/ C' @colname '/ w "@whereclause '" / f ' @filename ' / ' @direction exec master..xp_cmdshell @exec_str

Below is an example of a copy image to the Pubs database of SQL Server, a table name pub_info, field name logo, image file name Picture.BMP, save to PUB_ID = '0736' record sp_textcopy @srvname = 'servername', @login = 'Login ', @Password =' ​​pubs ', @tbname =' pub_info ', @colname =' logo ', @filename =' c: /Picture.bmp ', @whereclause = "Where pub_id =' 0736 '", @direction =' i '

Delphi:

Procedure TForm1.Button1Click (Sender: TOBJECT); Begin if OpenPictureDialog1.execute the Image1.Picture.loadFromFile (OpenPictureDialog1.FileName);

procedure TForm1.Button2Click (Sender: TObject);. begin ADOTable1.Append; TBlobField (ADOTable1.FieldByName ( 'FImage')) LoadFromFile (OpenPictureDialog1.FileName); ADOTable1.Post; end; you to create table table (id int, myimage Image) GoInsert table values ​​(2,0x) GO - call the above process: sp_textcopy 'Your server name', 'sa', 'your password', 'test', 'dali', 'MyImage', 'C : / Picture. Bmp ',' Where ID = 2 ',' I '- Note the condition is ID = 2 - OK

Connection

Http://search.9cbs.net/expert/topic/1673/1673711.xml?temp=.5985681

http://www.9cbs.net/develop/read_article.asp?id=17699

转载请注明原文地址:https://www.9cbs.com/read-128056.html

New Post(0)