dbTalk Databases Forums  

Problems with updating SAP table using WCF LOB Adapter

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Problems with updating SAP table using WCF LOB Adapter in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Johan Machielse
 
Posts: n/a

Default Problems with updating SAP table using WCF LOB Adapter - 01-23-2009 , 02:41 AM






Hi,

Within SAP the table "TableName" resides which I query with select and
update SQL statements using the .NET Provider\SAP Data Provider which is part
of the WCF LOB Adapter.

Select statement: SELECT ColumnNameB FROM TableName WHERE ColumnNameA =
'MyValue'
Update statement: UPDATE TableName SET ColumnNameB = 'MyData' WHERE
ColumnNameA = 'MyValue'

I tried to execute those SQL statements using an Execute SQL Task and a
Script Component. The selection of data works perfect, but updating data
raises an error (the administrator gave me full privileges to the table):

Error: Executing the query "UPDATE TableName SET ColumnNameB = 'MyData'
WHERE ColumnNameA = 'MyValue'" failed with the following error: "Syntax error
in the specified query. Specify a valid query.". Possible failure reasons:
Problems with the query, "ResultSet" property not set correctly, parameters
not set correctly, or connection not established correctly.



Selecting data works...

Public Overrides Sub CreateNewOutputRows()
Dim sapCmd As IDbCommand
Dim sapRdr As IDataReader
Dim sapConnection As IDbConnection
Dim affectedRows As Int32

Try
sapConnection =
CType(Connections.Connection.AcquireConnection(Not hing), IDbConnection)
sapCmd = sapConnection.CreateCommand()
sapCmd.CommandText = "SELECT ColumnNameB FROM TableName WHERE
ColumnNameA = 'MyValue'"
sapCmd.Prepare()
sapRdr = sapCmd.ExecuteReader()

While (sapRdr.Read())
OutputRowsBuffer.AddRow()
OutputRowsBuffer.Value = sapRdr.GetString(1)
End While

Catch ex As Exception
OutputRowsBuffer.AddRow()
OutputRowsBuffer.Value = ex.StackTrace.ToString()
End Try

End Sub



....but updating data fails.

Public Overrides Sub CreateNewOutputRows()
Dim sapCmd As IDbCommand
Dim sapRdr As IDataReader
Dim sapConnection As IDbConnection
Dim affectedRows As Int32

Try
sapConnection =
CType(Connections.Connection.AcquireConnection(Not hing), IDbConnection)
sapCmd = sapConnection.CreateCommand()
sapCmd.CommandText = "UPDATE TableName SET ColumnNameB = 'MyData'
WHERE ColumnName = 'MyValue'"
sapCmd.Prepare()
affectedRows = sapCmd.ExecuteNonQuery()
OutputRowsBuffer.AddRow()
OutputRowsBuffer.Value = affectedRows.ToString()
Catch ex As Exception
OutputRowsBuffer.AddRow()
OutputRowsBuffer.Value = ex.StackTrace.ToString()
End Try


End Sub


Has anyone experienced this problem before? How can I solve this problem?

Thank you in advance!

Regards,

Johan Machielse


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.