Is there a limitation on a string from a VB.NET oledb INSERT on a
FoxPro table's memo field?

I found I had to trim a system exception message string down to a length of
250,
otherwise I was getting an OLEDB exception of "Command contains
unrecognized phrase/keyword."

The system exception originally was 345 in length:

"System.Data.OleDb.OleDbException: Cannot open file
\\myserver\vol1\folder1\subfolder\mydir\dbfs\test\cond_eom.dbf.
at OSPUserClose.Prepost.makeEOMFiles() in
D:\dev\OSPUserClose\OSPUserClose\Prepost.vb:line 597
at OSPUserClose.Prepost.RunPrepostButton_Click(Object sender, EventArgs
e) in D:\dev\OSPUserClose\OSPUserClose\Prepost.vb:line 92"

I removed any single quotes, chr(10) and chr(13)'s and nothing else unusual
appears when I read the Hex
values.

Below is an example of my vb code. It only fails on the string above, so
far.

Thanks in advance,
Marc Miller


Dim strOleDbCommand2 As OleDbCommand = New OleDbCommand("INSERT INTO
error_log " & _
"VALUES ('" & strProcName & "', datetime(),'" & strUser &
"','" & strError & "')", oConn)

oConn.Open()
strOleDbCommand2.ExecuteNonQuery()

Re: Insert into memo field from vb.net oledb by Cindy

Cindy
Wed Jan 17 15:58:37 CST 2007

Hi Marc,

There is a limit of 255 characters on the length of a string literal. You
should be able to get around this by sending the value as a parameter to
your Insert statement.

--
Cindy Winegarden MCSD, Microsoft Most Valuable Professional
cindy@cindywinegarden.com


"Marc Miller" <ctefsd_sys@hotmail.com> wrote in message
news:uaSqiUmOHHA.3872@TK2MSFTNGP06.phx.gbl...
> Is there a limitation on a string from a VB.NET oledb INSERT on a
> FoxPro table's memo field?

> Dim strOleDbCommand2 As OleDbCommand = New OleDbCommand("INSERT INTO
> error_log " & _
> "VALUES ('" & strProcName & "', datetime(),'" & strUser
> & "','" & strError & "')", oConn)



Re: Insert into memo field from vb.net oledb by Anders

Anders
Thu Jan 18 05:05:16 CST 2007

Longer string literals can be split and concatenated: 'first 254 chars'+
'another string of 254 bytes'
Usually they are put in a variable or parameter.
-Anders

"Marc Miller" <ctefsd_sys@hotmail.com> skrev i meddelandet
news:uaSqiUmOHHA.3872@TK2MSFTNGP06.phx.gbl...
> Is there a limitation on a string from a VB.NET oledb INSERT on a
> FoxPro table's memo field?
>
> I found I had to trim a system exception message string down to a length
> of 250,
> otherwise I was getting an OLEDB exception of "Command contains
> unrecognized phrase/keyword."
>
> The system exception originally was 345 in length:
>
> "System.Data.OleDb.OleDbException: Cannot open file
> \\myserver\vol1\folder1\subfolder\mydir\dbfs\test\cond_eom.dbf.
> at OSPUserClose.Prepost.makeEOMFiles() in
> D:\dev\OSPUserClose\OSPUserClose\Prepost.vb:line 597
> at OSPUserClose.Prepost.RunPrepostButton_Click(Object sender, EventArgs
> e) in D:\dev\OSPUserClose\OSPUserClose\Prepost.vb:line 92"
>
> I removed any single quotes, chr(10) and chr(13)'s and nothing else
> unusual appears when I read the Hex
> values.
>
> Below is an example of my vb code. It only fails on the string above, so
> far.
>
> Thanks in advance,
> Marc Miller
>
>
> Dim strOleDbCommand2 As OleDbCommand = New OleDbCommand("INSERT INTO
> error_log " & _
> "VALUES ('" & strProcName & "', datetime(),'" & strUser
> & "','" & strError & "')", oConn)
>
> oConn.Open()
> strOleDbCommand2.ExecuteNonQuery()
>
>
>
>
>



Re: Insert into memo field from vb.net oledb by Anders

Anders
Thu Jan 18 05:05:16 CST 2007

Longer string literals can be split and concatenated: 'first 254 chars'+
'another string of 254 bytes'
Usually they are put in a variable or parameter.
-Anders

"Marc Miller" <ctefsd_sys@hotmail.com> skrev i meddelandet
news:uaSqiUmOHHA.3872@TK2MSFTNGP06.phx.gbl...
> Is there a limitation on a string from a VB.NET oledb INSERT on a
> FoxPro table's memo field?
>
> I found I had to trim a system exception message string down to a length
> of 250,
> otherwise I was getting an OLEDB exception of "Command contains
> unrecognized phrase/keyword."
>
> The system exception originally was 345 in length:
>
> "System.Data.OleDb.OleDbException: Cannot open file
> \\myserver\vol1\folder1\subfolder\mydir\dbfs\test\cond_eom.dbf.
> at OSPUserClose.Prepost.makeEOMFiles() in
> D:\dev\OSPUserClose\OSPUserClose\Prepost.vb:line 597
> at OSPUserClose.Prepost.RunPrepostButton_Click(Object sender, EventArgs
> e) in D:\dev\OSPUserClose\OSPUserClose\Prepost.vb:line 92"
>
> I removed any single quotes, chr(10) and chr(13)'s and nothing else
> unusual appears when I read the Hex
> values.
>
> Below is an example of my vb code. It only fails on the string above, so
> far.
>
> Thanks in advance,
> Marc Miller
>
>
> Dim strOleDbCommand2 As OleDbCommand = New OleDbCommand("INSERT INTO
> error_log " & _
> "VALUES ('" & strProcName & "', datetime(),'" & strUser
> & "','" & strError & "')", oConn)
>
> oConn.Open()
> strOleDbCommand2.ExecuteNonQuery()
>
>
>
>
>