Cannot Read Errors That Coming from Oracle Provider (277136)



The information in this article applies to:

  • Microsoft Commerce Server 2002
  • Microsoft Commerce Server 2000

This article was previously published under Q277136

SUMMARY

When a profile data source is mapped to an Oracle database, error message information is not returned in the Errors collection of the Commerce OLE DB provider if an error occurs in the Oracle data source. This is a limitation of the Oracle provider, and not the Commerce OLE DB provider.

MORE INFORMATION

The following code can reproduce this behavior when you use a profile data member contained in Oracle.

Note In the following sample code, you must change uid=<username> and pwd=<strong password> to the correct values. Make sure that the user ID has the appropriate permissions to perform this operation on the database.
On Error Resume Next

ProfileName = "test"
ProfileType = "Users"

ConnStr = "Provider=CSOLEDB;Server=MyServer;Database=Retail_Commerce;uid=<username>;pwd=<strong password>"
Catalog = "Profile Definitions"

Set objProfileSvc = CreateObject("Commerce.ProfileService")
objProfileSvc.Initialize ConnStr, Catalog
if err.number <> 0 then
   errstr = "Errors for Initialize: " & vbcrlf
   set objerr = objprofileSvc.Errors

   for each er in objerr
      errstr = errstr & "Num: " & er.number & " Desc: " & er.description 
   next
   wscript.echo errstr
end if

Set objProfile = objProfileSvc.CreateProfile(ProfileName , ProfileType )
if err.number <> 0 then
   errstr = "Errors for Create profile: " & vbcrlf
   set objerr = objprofileSvc.Errors
   for each er in objerr
      errstr = errstr & "Num: " & er.number & " Desc: " & er.description 
   next
   wscript.echo errstr
end if

'Set the property value
field = "name"
objProfile.fields(field).Value = ProfileName 

field = "mynumber"
' this is too big for the column to hold
objProfile.fields(field).Value = 1234567   
objProfile.update

if err.number <> 0 then
   errstr = "Errors for Update: " & vbcrlf
   set objerr = objprofileSvc.Errors
   for each er in objerr
      errstr = errstr & "Num: " & er.number & " Desc: " & er.description 
   next
      wscript.echo errstr
end if

set objProfile = Nothing

Set objProfile = objProfileSvc.GetProfile(ProfileName , ProfileType )
if err.number <> 0 then
   errstr = "Errors for GetProfile: " & vbcrlf
   set objerr = objprofileSvc.Errors
   for each er in objerr
      errstr = errstr & "Num: " & er.number & " Desc: " & er.description
   next
   wscript.echo errstr		
else
   ' display the value
   name = objProfile.fields(field).name
   type1 = objProfile.fields(field).type
   value = objProfile.fields(field).value
   wscript.echo "Name: " & name & vbcrlf 
   wscript.echo "type: " & type1 & vbcrlf 
   wscript.echo "Value: " & value
end if

' delete it
objProfileSvc.deleteProfile ProfileName , ProfileType 

wscript.echo "finished"
				
The third-party products that are discussed in this article are manufactured by companies that are independent of Microsoft. Microsoft makes no warranty, implied or otherwise, regarding the performance or reliability of these products.

Modification Type:MajorLast Reviewed:2/25/2004
Keywords:kbinfo kbpending KB277136