Hello,

I have big problem on updating an Access Memo field with OleDb. While the
InsertCommand works, then UpdateCommand raises an exception: Syntaxerror in
UPDATE-Statement. I tryed various work arounds (the last 3 days) with and
without the CommandBuilder with allways the same result.

The last attempt was:

Public Function WriteMemoToAccess(ByVal Pars As String) As Boolean
'Parameters is the ColumnName of the Access Memo field
Dim AccessCommand As New OleDb.OleDbCommand("UPDATE DocH SET Parameters=?
WHERE IdNum = 1")

Dim QueryParameter As New OleDb.OleDbParameter("@Parameters", _
OleDb.OleDbType.LongVarWChar, Len(Pars), ParameterDirection.Input,
True, _
Nothing, Nothing, Nothing, DataRowVersion.Current, Pars)

AccessCommand.Parameters.Add(QueryParameter)
AccessCommand.Connection = Me.Connection
Me.Connection.Open()
Try
AccessCommand.ExecuteNonQuery()
WriteMemoToAccess = True
Catch ex As Exception
End Try
Me.Connection.Close()
End Function

Is there a way to do this??

Best regards

Alfred Malleier
(South Tyrol)

Re: Writing a Memo field to an Access DB with OleDB by Jim

Jim
Tue Aug 22 10:15:41 CDT 2006

Is the columnname you want to update really called Parameters?

If so, Parameters is probably a reserved word. Try wrapping it in [ ] or
even renaming the column and associated references.

"Alfred Malleier" <Alfred@Mastersoft.cc> wrote in message
news:uTtDiFfxGHA.1808@TK2MSFTNGP06.phx.gbl...
> Hello,
>
> I have big problem on updating an Access Memo field with OleDb. While the
> InsertCommand works, then UpdateCommand raises an exception: Syntaxerror
> in UPDATE-Statement. I tryed various work arounds (the last 3 days) with
> and without the CommandBuilder with allways the same result.
>
> The last attempt was:
>
> Public Function WriteMemoToAccess(ByVal Pars As String) As Boolean
> 'Parameters is the ColumnName of the Access Memo field
> Dim AccessCommand As New OleDb.OleDbCommand("UPDATE DocH SET
> Parameters=? WHERE IdNum = 1")
>
> Dim QueryParameter As New OleDb.OleDbParameter("@Parameters", _
> OleDb.OleDbType.LongVarWChar, Len(Pars), ParameterDirection.Input,
> True, _
> Nothing, Nothing, Nothing, DataRowVersion.Current, Pars)
>
> AccessCommand.Parameters.Add(QueryParameter)
> AccessCommand.Connection = Me.Connection
> Me.Connection.Open()
> Try
> AccessCommand.ExecuteNonQuery()
> WriteMemoToAccess = True
> Catch ex As Exception
> End Try
> Me.Connection.Close()
> End Function
>
> Is there a way to do this??
>
> Best regards
>
> Alfred Malleier
> (South Tyrol)
>
>



Re: Writing a Memo field to an Access DB with OleDB by Alfred

Alfred
Tue Aug 22 10:20:34 CDT 2006


"Jim Hughes" <NOSPAMJ3033@Hotmail.com> schrieb im Newsbeitrag
news:%23fNlV3fxGHA.5064@TK2MSFTNGP04.phx.gbl...
> Is the columnname you want to update really called Parameters?
>
> If so, Parameters is probably a reserved word. Try wrapping it in [ ] or
> even renaming the column and associated references.

Yes, Parameters is a keyword in OleDb. I found this 10 min ago.
But I find no work around in programm code. I need to change the name in the
Access db

Thank you very much.

Alfred M.

>
> "Alfred Malleier" <Alfred@Mastersoft.cc> wrote in message
> news:uTtDiFfxGHA.1808@TK2MSFTNGP06.phx.gbl...
>> Hello,
>>
>> I have big problem on updating an Access Memo field with OleDb. While the
>> InsertCommand works, then UpdateCommand raises an exception: Syntaxerror
>> in UPDATE-Statement. I tryed various work arounds (the last 3 days) with
>> and without the CommandBuilder with allways the same result.
>>
>> The last attempt was:
>>
>> Public Function WriteMemoToAccess(ByVal Pars As String) As Boolean
>> 'Parameters is the ColumnName of the Access Memo field
>> Dim AccessCommand As New OleDb.OleDbCommand("UPDATE DocH SET
>> Parameters=? WHERE IdNum = 1")
>>
>> Dim QueryParameter As New OleDb.OleDbParameter("@Parameters", _
>> OleDb.OleDbType.LongVarWChar, Len(Pars), ParameterDirection.Input,
>> True, _
>> Nothing, Nothing, Nothing, DataRowVersion.Current, Pars)
>>
>> AccessCommand.Parameters.Add(QueryParameter)
>> AccessCommand.Connection = Me.Connection
>> Me.Connection.Open()
>> Try
>> AccessCommand.ExecuteNonQuery()
>> WriteMemoToAccess = True
>> Catch ex As Exception
>> End Try
>> Me.Connection.Close()
>> End Function
>>
>> Is there a way to do this??
>>
>> Best regards
>>
>> Alfred Malleier
>> (South Tyrol)
>>
>>
>
>



Re: Writing a Memo field to an Access DB with OleDB by Paul

Paul
Tue Aug 22 13:40:55 CDT 2006

On Tue, 22 Aug 2006 17:20:34 +0200, "Alfred Malleier" <Alfred@Mastersoft.cc> wrote:


¤ > Is the columnname you want to update really called Parameters?
¤ >
¤ > If so, Parameters is probably a reserved word. Try wrapping it in [ ] or
¤ > even renaming the column and associated references.
¤
¤ Yes, Parameters is a keyword in OleDb. I found this 10 min ago.
¤ But I find no work around in programm code. I need to change the name in the
¤ Access db
¤

As Jim mentioned you can enclose it within brackets: [Parameters]


Paul
~~~~
Microsoft MVP (Visual Basic)

Re: Writing a Memo field to an Access DB with OleDB by Alfred

Alfred
Wed Aug 23 02:57:24 CDT 2006


"Paul Clement" <UseAdddressAtEndofMessage@swspectrum.com> schrieb im
Newsbeitrag news:iqjme25pqra03maoptnpgeecd19sbab992@4ax.com...
> On Tue, 22 Aug 2006 17:20:34 +0200, "Alfred Malleier"
> <Alfred@Mastersoft.cc> wrote:
>
>
> ¤ > Is the columnname you want to update really called Parameters?
> ¤ >
> ¤ > If so, Parameters is probably a reserved word. Try wrapping it in [ ]
> or
> ¤ > even renaming the column and associated references.
> ¤
> ¤ Yes, Parameters is a keyword in OleDb. I found this 10 min ago.
> ¤ But I find no work around in programm code. I need to change the name in
> the
> ¤ Access db
> ¤
>
> As Jim mentioned you can enclose it within brackets: [Parameters]
>
>
> Paul
> ~~~~
> Microsoft MVP (Visual Basic)

Many Thanks,

but if I enclose them in the SelectCommand why the CommandBuilder does not
enclose them in the other commands too?

Alfred M.



Re: Writing a Memo field to an Access DB with OleDB by Paul

Paul
Wed Aug 23 07:18:25 CDT 2006

On Wed, 23 Aug 2006 09:57:24 +0200, "Alfred Malleier" <Alfred@Mastersoft.cc> wrote:


¤ > ¤ > Is the columnname you want to update really called Parameters?
¤ > ¤ >
¤ > ¤ > If so, Parameters is probably a reserved word. Try wrapping it in [ ]
¤ > or
¤ > ¤ > even renaming the column and associated references.
¤ > ¤
¤ > ¤ Yes, Parameters is a keyword in OleDb. I found this 10 min ago.
¤ > ¤ But I find no work around in programm code. I need to change the name in
¤ > the
¤ > ¤ Access db
¤ > ¤
¤ >
¤ > As Jim mentioned you can enclose it within brackets: [Parameters]
¤ >
¤ >
¤ > Paul
¤ > ~~~~
¤ > Microsoft MVP (Visual Basic)
¤
¤ Many Thanks,
¤
¤ but if I enclose them in the SelectCommand why the CommandBuilder does not
¤ enclose them in the other commands too?

Because the CommandBuilder was not designed to handle this issue. You have to make the modification
manually.


Paul
~~~~
Microsoft MVP (Visual Basic)