Home > database >  Help everyone Foxer, about VFP9 using SQL SERVER file transfer problem.
Help everyone Foxer, about VFP9 using SQL SERVER file transfer problem.

Time:09-26

I want to take advantage of SQL SERVER transfer files, at present oneself for several days, still have all sorts of problems, and baidu is there really no solution, come to consult,
Please supervise your greatly help to have a look at, inadvertently grateful,
Due to the bad, the code is written in the Form post, so the screenshots down,

remote view field types and VFP database field types below
The database

Remote view

file upload download, respectively below
Upload

Download

Now meet a problem, is if the transfer is larger than 400 k values of (about) the file will be submitted to the below error, small file test are OK, and will not happen file is damaged,

error screenshot below


I tried to used in the filecontent the type of this field from varbinary (MAX) into a text, find file size limit, don't put the mistakes, but they also found that some files damage happened in the process of transmission, file size becomes smaller than the original, some don't, very strange,

Really don't understand, what do to transfer files, to consult everybody greatly, also please comment, thank you so much,

CodePudding user response:

Can upload the maximum 180 m more files to SQL2000 [share]
* from plum BBS
* the clear
=sqlsetprop (0, [DISPWARNINGS], (. F.)) & amp; & Don't prompt error message
=sqlsetprop (0, [DISPLOGIN], 3) & amp; & Don't show the ODBC login
=sqlsetprop (0, [CONNECTTIMEOUT], 10) & amp; & Connection wait time
=sqlsetprop (0, QUERYTIMEOUT, 600) & amp; & Error waiting time
=sqlsetprop (0, [WaitTime], 600) & amp; & Before execution delay time
* QUERYTIMEOUT parameter, start is 10, the maximum to 40 m, finally set up to 600, to 280 m, but check the SQL2000 data found that when more than 185 m, the data is invalid, test condition SQL2000 + VFP9.0 + Windows 7 32
* download now, I found a problem, when the program first download, will quote mistakes in red, say to want to note fields can be, but points to cancel after the second time to download, don't quote error, can download data normally,
Con=sqlstringconnect (" driver=SQL server; Server=atm8505; Uid=sa; The PWD=zjh123456; The database=master ")
If con> 0
Xfiles=GETFILE ()
IF! The EMPTY (xfiles) & amp; &
M1=LEN (CREATEBINARY (Filetostr (' & amp; Xfiles')))
The SET COMPATIBLE ON
? M1
Xx=SQLEXEC (con, "insert into test (id, img) values (?,?,?,?,? INT (M1/1000000),? CREATEBINARY (Filetostr (' & amp; Xfiles'))))
The SET COMPATIBLE OFF
? Con, xx
The ELSE

* the download
Xfiles=[g: \ a1. Rar]
CURSORSETPROP (" MapBinary ", t., 0) & amp; & It must be in front of the following
Xx=SQLEXEC (con, SELECT ID, "img FROM test WHERE ID=184", "temp")

COPY MEMO TEMP. Img TO & amp; Xfiles
? Con, xx
USE TEMP IN
ENDIF

SQLDISCONNECT (con)
ENDIF

CodePudding user response:

reference 1st floor mywisdom88 response:
can upload the maximum 180 m more files to SQL2000 [share]
* from plum BBS
* the clear
=sqlsetprop (0, [DISPWARNINGS], (. F.)) & amp; & Don't prompt error message
=sqlsetprop (0, [DISPLOGIN], 3) & amp; & Don't show the ODBC login
=sqlsetprop (0, [CONNECTTIMEOUT], 10) & amp; & Connection wait time
=sqlsetprop (0, QUERYTIMEOUT, 600) & amp; & Error waiting time
=sqlsetprop (0, [WaitTime], 600) & amp; & Before execution delay time
* QUERYTIMEOUT parameter, start is 10, the maximum to 40 m, finally set up to 600, to 280 m, but check the SQL2000 data found that when more than 185 m, the data is invalid, test condition SQL2000 + VFP9.0 + Windows 7 32
* download now, I found a problem, when the program first download, will quote mistakes in red, say to want to note fields can be, but points to cancel after the second time to download, don't quote error, can download data normally,
Con=sqlstringconnect (" driver=SQL server; Server=atm8505; Uid=sa; The PWD=zjh123456; The database=master ")
If con> 0
Xfiles=GETFILE ()
IF! The EMPTY (xfiles) & amp; &
M1=LEN (CREATEBINARY (Filetostr (' & amp; Xfiles')))
The SET COMPATIBLE ON
? M1
Xx=SQLEXEC (con, "insert into test (id, img) values (?,?,?,?,? INT (M1/1000000),? CREATEBINARY (Filetostr (' & amp; Xfiles'))))
The SET COMPATIBLE OFF
? Con, xx
The ELSE

* the download
Xfiles=[g: \ a1. Rar]
CURSORSETPROP (" MapBinary ", t., 0) & amp; & It must be in front of the following
Xx=SQLEXEC (con, SELECT ID, "img FROM test WHERE ID=184", "temp")

COPY MEMO TEMP. Img TO & amp; Xfiles
? Con, xx
USE TEMP IN
ENDIF

SQLDISCONNECT (con)
ENDIF
my own solution, you of this method is not applicable to my situation

CodePudding user response:

Unified reply, not just after I send this post, I will solve, now share out, in order to help the future Foxer,
The correct configuration is essentially a side field type USES the text type, Remote View (Remote View) of the field types by M type
Upload the transcoding part adopts lcfilecontent=STRCONV (FILETOSTR (lcfilepath), 13)
Retrieve the data from the server using STRTOFILE (STRCONV (lcfilecontent, 14), lcfilepath)
Tested VFP9 + SQLSERVER2008 perfect use, size damage will not occur file, or the error in the figure above,
Any questions please contact me qq: 965153532
This post to end,

CodePudding user response:

Suggest using SPT access SQL server with remote view all kinds of pit,,
  •  Tags:  
  • VFP
  • Related