Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to update a text field of SQL Server with VFP memo f
Message
De
20/09/2004 15:49:40
 
 
À
17/09/2004 14:08:47
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00943525
Message ID:
00944186
Vues:
21
>I have problem in updating a text field of SQL Server using ODBC from the content of VFP memo field if the content of the memo contains this:
>
>ABC\
>TEST
>
>Note: There is a chr(13) after \.
>
>If I issue statement like this:
>
>update table set sqltext = ?vfp8.memofield
>
>The text field will contain:
>
>ABC
>TEST
>
>
>The backwards slash will disappear. This happens only if the VFP memo contains backwards slash followed by chr(13) or chr(10).
>
>How can I update such memo content to SQL text field?
>
>
>Thank you for any help.

Hi Peter,

This doesn't look like a VFP BUG. VFP does pass values from MEMO fields a little bit different, but it doesn't do string substitution as Fabio claims.

With the following code:
CLEAR 
CREATE CURSOR foo (f1 M)
INSERT INTO foo VALUES ("Test\"+CHR(13)+"tesT")
?foo.f1,LEN(foo.f1)
con=SQLCONNECT("LocalServer")
?SQLEXEC(con,"select ?foo.f1", "TextTest")
?exp,LEN(exp)
?
INSERT INTO foo VALUES ("Test"+CHR(0)+"tesT")
?foo.f1,LEN(foo.f1)
?SQLEXEC(con,"select ?foo.f1", "TextTest")
?exp,LEN(exp)
?
?ASC(RIGHT(exp,5))
The following ODBC trace shows that VFP passes all 10 characters for the first SQLEXEC and all 9 characters for the second. There is no string substitution, there is no parameter truncation all characters are passed.
vfp8            a60-318	ENTER SQLBindParameter 
		HSTMT               01E61D58
		UWORD                        1 
		SWORD                        1 <SQL_PARAM_INPUT>
		SWORD                        1 <SQL_C_CHAR>
		SWORD                       12 <SQL_VARCHAR>
		SQLULEN                   10
		SWORD                        0 
		PTR                0x00000000
		SQLLEN                     0
		SQLLEN *            0x01094A50

vfp8            a60-318	EXIT  SQLBindParameter  with return code 0 (SQL_SUCCESS)
		HSTMT               01E61D58
		UWORD                        1 
		SWORD                        1 <SQL_PARAM_INPUT>
		SWORD                        1 <SQL_C_CHAR>
		SWORD                       12 <SQL_VARCHAR>
		SQLULEN                   10
		SWORD                        0 
		PTR                0x00000000
		SQLLEN                     0
		SQLLEN *            0x01094A50 (-110)

vfp8            a60-318	ENTER SQLExecDirect 
		HSTMT               01E61D58
		UCHAR *             0x0108BDA0 [      -3] "select ? \ 0"
		SDWORD                    -3

vfp8            a60-318	EXIT  SQLExecDirect  with return code 99 (SQL_NEED_DATA)
		HSTMT               01E61D58
		UCHAR *             0x0108BDA0 [      -3] "select ? \ 0"
		SDWORD                    -3

vfp8            a60-318	ENTER SQLParamData 
		HSTMT               01E61D58
		PTR *              0x0012F70C

vfp8            a60-318	EXIT  SQLParamData  with return code 99 (SQL_NEED_DATA)
		HSTMT               01E61D58
		PTR *              0x0012F70C

vfp8            a60-318	ENTER SQLPutData 
		HSTMT               01E61D58
		PTR                0x010974A8
		SQLLEN                    10

vfp8            a60-318	EXIT  SQLPutData  with return code 0 (SQL_SUCCESS)
		HSTMT               01E61D58
		PTR                0x010974A8
		SQLLEN                    10


...


vfp8            a60-318	ENTER SQLBindParameter 
		HSTMT               01E61D58
		UWORD                        1 
		SWORD                        1 <SQL_PARAM_INPUT>
		SWORD                        1 <SQL_C_CHAR>
		SWORD                       12 <SQL_VARCHAR>
		SQLULEN                    9
		SWORD                        0 
		PTR                0x00000000
		SQLLEN                     0
		SQLLEN *            0x01096D18

vfp8            a60-318	EXIT  SQLBindParameter  with return code 0 (SQL_SUCCESS)
		HSTMT               01E61D58
		UWORD                        1 
		SWORD                        1 <SQL_PARAM_INPUT>
		SWORD                        1 <SQL_C_CHAR>
		SWORD                       12 <SQL_VARCHAR>
		SQLULEN                    9
		SWORD                        0 
		PTR                0x00000000
		SQLLEN                     0
		SQLLEN *            0x01096D18 (-109)

vfp8            a60-318	ENTER SQLExecDirect 
		HSTMT               01E61D58
		UCHAR *             0x00E8F930 [      -3] "select ? \ 0"
		SDWORD                    -3

vfp8            a60-318	EXIT  SQLExecDirect  with return code 99 (SQL_NEED_DATA)
		HSTMT               01E61D58
		UCHAR *             0x00E8F930 [      -3] "select ? \ 0"
		SDWORD                    -3

vfp8            a60-318	ENTER SQLParamData 
		HSTMT               01E61D58
		PTR *              0x0012F234

vfp8            a60-318	EXIT  SQLParamData  with return code 99 (SQL_NEED_DATA)
		HSTMT               01E61D58
		PTR *              0x0012F234

vfp8            a60-318	ENTER SQLPutData 
		HSTMT               01E61D58
		PTR                0x01097CB8
		SQLLEN                     9

vfp8            a60-318	EXIT  SQLPutData  with return code 0 (SQL_SUCCESS)
		HSTMT               01E61D58
		PTR                0x01097CB8
		SQLLEN                     9
Thanks,
Aleksey.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform