Using SQL statements in the code


Author
Message
Kari Paukku
Kari Paukku
StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)
Group: Forum Members
Posts: 65, Visits: 820
Hi,

I would like to insert an excel-file as a blob into a Oracle-table. The workflow is that the user would look up a contact and the add the file to that contact. For looking up the contact a SF business object is used. After the contact and file has been selected the blob insert could then be done in the code.

What would be the best way to do this? For me a straight INSERT SQL-statement would work fine in this, but how can I refer to the already existing SF-connection?
The language is VB.Net.

TIA,

Kari

Replies
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
What does the structure of your table look like?
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
If you are setting your PrimaryKeyIsAutoIncremented property to False, then you will need to manually specify a primary key for the property.  Also, if you set the PrimaryKeyIsAutoIncremented property to True, then you will need to set the OracleSequenceName property on the business object so the business object knows what sequence to use for the auto-incrementing of the primary key.  It is possible that the OracleSequenceName is nothing and that might be what is throwing the error.  Try setting the sequence and let me know what happens.
Kari Paukku
Kari Paukku
StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)
Group: Forum Members
Posts: 65, Visits: 820
Hi,

I have tried both options - that is setting the autoincrement to true and false. No success. I did additional testing using a very simple table from Oracle's SCOTT.EMP using just two columns (EMPNO and ENAME)

As you see - the original error was coming from Oracle but when the autoincrement thing was fixed, then the VB.Net started to give the errors. One more thing, in the debug-window is now SQL-statement for the INSERT.

Would it be possible for you to write a simple application that can be used to enter a row to Oracle's SCOTT.EMP table? Then I could verify that it works in my environment and I could also use that as a reference point whe trying to figure out where it goes wrong. The database version 10g and I'm using VB.Net.

Cheers,

Kari

Kari Paukku
Kari Paukku
StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)
Group: Forum Members
Posts: 65, Visits: 820
Ben,

attached is a small application that retrieves data from table EMP.
When you retrieve data and update that's fine.
When you insert a new record (use e.g. 1 for EMPNO and Bart for ENAME) then error appears. Autoincrement is set to false.

Cheers,

Kari

Attachments
WinSCOTT.zip (126 views, 781.00 KB)
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
OK, Kari, there is no sequence created that you can use for inserting records into the Scott.Emp table.  So, I tried to manually assign one and got the same error you did.  I tracked it down and corrected the problem and we will be posting an update before the end of the week with some changes to the activation wizard, so this will be included as well.  Thanks for your patience.
Kari Paukku
Kari Paukku
StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)StrataFrame User (139 reputation)
Group: Forum Members
Posts: 65, Visits: 820
Hi,
just as information, after downloading the latest version of SF (dated 10-10-2006) the attached sample worked and allowed to create a new record into the EMP table.

Cheers,
Kari

ps. Incase somebody tries the example - add the DEPTNO field to the form. Otherwise you get a referential integrity error from Oracle.

StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Good to know about that foreign key that exists on the EMPS table.  Thanks for the heads up and I'm glad you're working Smile
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Kari Paukku - 19 Years Ago
Trent L. Taylor - 19 Years Ago
Kari Paukku - 19 Years Ago
Trent L. Taylor - 19 Years Ago
Kari Paukku - 19 Years Ago
Kari Paukku - 19 Years Ago
StrataFrame Team - 19 Years Ago
StrataFrame Team - 19 Years Ago
Kari Paukku - 19 Years Ago
                         Ben, attached is a small application that retrieves data from table...
Kari Paukku - 19 Years Ago
                             OK, Kari, there is no sequence created that you can use for inserting...
StrataFrame Team - 19 Years Ago
                             Hi, just as information, after downloading the latest version of SF...
Kari Paukku - 19 Years Ago
                                 Good to know about that foreign key that exists on the EMPS table....
StrataFrame Team - 19 Years Ago
Kari Paukku - 19 Years Ago
StrataFrame Team - 19 Years Ago
                 Ben, thank you very much. Kari
Kari Paukku - 19 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search