|
Home > Archive > Commerce Server General > August 2005 > Inserting values into custom class error
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Inserting values into custom class error
|
|
| Alexander Yushchenko 2005-08-16, 5:57 pm |
| I use MSCS2002 + SP3 + FP1
I have extended dw with a custom class Region_ZipCode (consisting
of 2 fields) with the use of 'CreateSchemaObject.vbs' script from SDK:
CreateClassDef cn, "Region_ZipCode", "test_Source", "", True, 0, ""
CreateMemberDef cn, "Region_ZipCode", "Zip", "WSTR8",
fGenerateColDef + fIsRequired + fPrimaryKey + fHasDefaultVal, "0", ""
CreateMemberDef cn, "Region_ZipCode", "Region_ID", "NUMBER",
fGenerateColDef + fIsRequired, "", ""
After that I try to execute the following code (written in c#):
ADODB.Connection adoConnection = new ADODB.ConnectionClass();
adoConnection.Open("Provider=commerce.dso.1;Data
Source=mscop://InProcConnect/Server=my_server:
Catalog=DWSchema:Database=my_database:Fa
stLoad=True:Connection_Retry=10:Connecti
on_Retry_Delay=30",
"my_user", "my_password", 0);
object nullObject = Type.Missing;
adoConnection.Execute("DELETE FROM Metro_ZipCode", out nullObject, 0);
adoConnection.Execute("INSERT INTO Region_ZipCode (Region_ID, Zip)
VALUES (1, '99999')", out nullObject, 0);
adoConnection.Close();
The first "Execute" command is successful.
The second one throws the following exception: "Exception from
HRESULT: 0xCA2D8038." And no more information.
Please, advice.
--
Yours faithfully,
Alexander Yushchenko
| |
| Brian Blum [MSFT] 2005-08-17, 5:57 pm |
| The CSOLEDB Provider doesn't support insert. You have to use the url
binding syntax to write data.
Below is a sample that writes an instance into the TaskHistory class.
Private Function SetTransactionStatus(dStarttime As Date, dEndTime As Date,
lTaskId As Long, sSiteName As String, iStatus As Integer) As Boolean
On Error GoTo lblError
Dim rec As ADODB.Record
Set rec = New ADODB.Record
rec.Open "instance/TaskHistory", g_CnProvider, adModeWrite,
adCreateCollection
rec("TaskID") = lTaskId
rec("OperationID") = SynTaskOperationId
rec("Status") = iStatus
rec("StartTime") = dStarttime
rec("EndTime") = dEndTime
rec("Description") = LoadResString(resSyncTask) & ":" &
oOptions.sDescription
rec("CommerceSiteName") = sSiteName
rec("SourceInfo") = g_sServer & "/MSCS_Admin"
rec("NumberOfTries") = 1
If iStatus = 1 Then
rec("PercentageComplete") = 100
End If
rec("__Commit") = 1
rec.Fields.Update ' required with the win2000 RC1 builds and after
rec.Close
rec.Open "instance/TaskHistory", g_CnProvider, adModeWrite,
adCreateCollection
rec("__Commit") = 2
rec.Fields.Update
rec.Close
Set rec = Nothing
SetTransactionStatus = True
Exit Function
lblError:
Set rec = Nothing
SetTransactionStatus = False
End Function
--------------------
Date: Tue, 16 Aug 2005 19:35:26 +0400
From: Alexander Yushchenko <sasha-yoush@mtu-net.ru>
User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)
X-Accept-Language: ru-ru, ru
MIME-Version: 1.0
Subject: Inserting values into custom class error
Content-Type: text/plain; charset=KOI8-R; format=flowed
Content-Transfer-Encoding: 7bit
Message-ID: <uTcThgnoFHA.2956@TK2MSFTNGP10.phx.gbl>
Newsgroups:
microsoft.public.commerceserver.datawarehousing,microsoft.public.commerceser
ver.general
NNTP-Posting-Host: mipt.server.ru 194.67.183.7
Lines: 1
Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.commerceserver.general:3213
microsoft.public.commerceserver.datawarehousing:490
X-Tomcat-NG: microsoft.public.commerceserver.general
I use MSCS2002 + SP3 + FP1
I have extended dw with a custom class Region_ZipCode (consisting
of 2 fields) with the use of 'CreateSchemaObject.vbs' script from SDK:
CreateClassDef cn, "Region_ZipCode", "test_Source", "", True, 0, ""
CreateMemberDef cn, "Region_ZipCode", "Zip", "WSTR8",
fGenerateColDef + fIsRequired + fPrimaryKey + fHasDefaultVal, "0", ""
CreateMemberDef cn, "Region_ZipCode", "Region_ID", "NUMBER",
fGenerateColDef + fIsRequired, "", ""
After that I try to execute the following code (written in c#):
ADODB.Connection adoConnection = new ADODB.ConnectionClass();
adoConnection.Open("Provider=commerce.dso.1;Data
Source=mscop://InProcConnect/Server=my_server:
Catalog=DWSchema:Database=my_database:Fa
stLoad=True:Connection_Retry=10:Conn
ection_Retry_Delay=30",
"my_user", "my_password", 0);
object nullObject = Type.Missing;
adoConnection.Execute("DELETE FROM Metro_ZipCode", out nullObject, 0);
adoConnection.Execute("INSERT INTO Region_ZipCode (Region_ID, Zip)
VALUES (1, '99999')", out nullObject, 0);
adoConnection.Close();
The first "Execute" command is successful.
The second one throws the following exception: "Exception from
HRESULT: 0xCA2D8038." And no more information.
Please, advice.
--
Yours faithfully,
Alexander Yushchenko
This posting is provided "AS IS" with no warranties, and confers no rights.
EBusiness Server Team
| |
| Alexander Yushchenko 2005-08-18, 7:49 am |
| Thanks for your answer!
The solution you suggested works.
But why do you say that insert is not supported? According to MSDN,
it is:
http://msdn.microsoft.com/library/d..._oledb_yxkd.asp
--
Yours faithfully,
Alexander Yushchenko
Brian Blum [MSFT] wrote:
> The CSOLEDB Provider doesn't support insert. You have to use the url
> binding syntax to write data.
>
> Below is a sample that writes an instance into the TaskHistory class.
| |
| Brian Blum [MSFT] 2005-08-18, 5:52 pm |
| The CSOLEDB Provider supports two modes of operation; fastload and
singleinstance. The mode is determined by the connection string parameter
Fastload.
Fastload does NOT support the command syntax, although there is a DELETE
command.
Singleinstance mode is used by the Profile subsystem, and does support the
SELECT, INSERT, UPDATE and DELETE statements.
Since your connection string specified Fastload=true, you can't INSERT, but
I should have been more clear the modes.
--------------------
Date: Thu, 18 Aug 2005 13:50:16 +0400
From: Alexander Yushchenko <sasha-yoush@mtu-net.ru>
User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)
X-Accept-Language: ru-ru, ru
MIME-Version: 1.0
Subject: Re: Inserting values into custom class error
References: <uTcThgnoFHA.2956@TK2MSFTNGP10.phx.gbl>
<B7gIhU1oFHA.3120@TK2MSFTNGXA01.phx.gbl>
In-Reply-To: <B7gIhU1oFHA.3120@TK2MSFTNGXA01.phx.gbl>
Content-Type: text/plain; charset=KOI8-R; format=flowed
Content-Transfer-Encoding: 7bit
Message-ID: <egJw9o9oFHA.2156@TK2MSFTNGP14.phx.gbl>
Newsgroups: microsoft.public.commerceserver.general
NNTP-Posting-Host: mipt.server.ru 194.67.183.7
Lines: 1
Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14.phx.gbl
Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.commerceserver.general:3235
X-Tomcat-NG: microsoft.public.commerceserver.general
Thanks for your answer!
The solution you suggested works.
But why do you say that insert is not supported? According to MSDN,
it is:
http://msdn.microsoft.com/library/d...-us/csvr2002/ht
m/cs_rp_oledb_yxkd.asp
--
Yours faithfully,
Alexander Yushchenko
Brian Blum [MSFT] wrote:
> The CSOLEDB Provider doesn't support insert. You have to use the url
> binding syntax to write data.
>
> Below is a sample that writes an instance into the TaskHistory class.
This posting is provided "AS IS" with no warranties, and confers no rights.
EBusiness Server Team
|
|
|
|
|