473,387 Members | 1,528 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Command text was not set for the command object - error from dbms_lob.writeappend

I am rather new at this code and am attempting to modify existing code to use clob datatypes, which I have never used before. The database tables have been set up for clob data. When trying to use dbms_lob.writeappend, I am getting the following error..Command text was not set for the command object.
I've researched this in the net as much as I could, but I'm lost in what I am doing wrong. Can you help please?

Here is my code...

[FUNCTIONS]

<!-- #INCLUDE FILE="adovbs.inc" -->

<%
''################################################ #
''# Description: A class used to handle the data manipulation language
''# features of SQL. A Logger is also used for error handling.
''#
''################################################ #
Class SQL
''## The ADODB Connection
Dim connection
''## A result set
Dim resultSet
''## Column value pairs used for inserting and updating
Dim columnValuePairs
''## Name of table, used for checking for valid input on inserting and updating
Dim tableName
''## A logger forthe writedbSelect method
Dim SQLLogger

''## A variable used for looping
Dim I

''###############################################
''# Function: dbConnect
''# Description: Establish a connection to the database
''###############################################
Public Sub dbConnect()
'' ## Set connection = Server.CreateObject("ADODB.Connection")
'' ##connection.Open Application("dbName"), Application("dbLogin"), Application("dbPassword")
Set connection = Server.CreateObject("ADODB.Connection")
connection.Open "Provider=OraOLEDB.Oracle;User ID=" & Application("dbLogin") & ";Password=" & Application("dbPassword") & ";Data Source=" & Application("dbName") & ";"
End Sub

''###############################################
''# Function: dbClose
''# Description: Close the database connection.
''###############################################
Public Sub dbClose()
connection.Close
Set connection = Nothing
connection = ""
End Sub

''###############################################
''# Function addColumnValuePair
''# Description: Adds to the Dictionary Object columnValuePairs to be used
''# with inserting and updating. See dbUpdateBegin and dbInsertBegin for example
''# of use.
''# @param column The table column
''# @param value The value of the column
''###############################################
Public Sub addColumnValuePair(column, value)
''## Insert code to make sure types of columns match types of values (use tableName)
columnValuePairs.add column, value
End Sub

''###############################################
''# Function dbUpdateBegin
''# Description: Begin constructing an UPDATE on the database. All arguments are
''# required.
''# @param table The table to update
''#
''# Update Example:
''# Set sequel = New SQL
''# sequel.init
''# sequel.dbConnect
''# sequel.dbUpdateBegin "employees"
''# sequel.addColumnValuePair "FirstName", "John"
''# sequel.addColumnValuePair "LastName", "Doe"
''# sequel.addColumnValuePair "Company", "Company"
''# sequel.dbUpdateEnd "employeeId=1"
''# sequel.dbClose
''###############################################
Public Sub dbUpdateBegin(table)
tableName = table
columnValuePairs.removeAll
End Sub

''###############################################
''# Function dbUpdateEnd
''# Description: Finish constructing an UPDATE statementon the database
''# and execute it. The condition argument is required but an empty string may
''# be provided. See dbUpdateBegin for example of use.
''# @param condition What to specify in the WHERE clause
''###############################################
Public Sub dbUpdateEnd(condition)
Dim errDesc


sqlStatement = constructDbUpdate(condition)

On Error Resume Next
connection.Execute(sqlStatement)
If Err.Number<>0 Then
errDesc = Err.Description
On Error Goto 0
Err.Raise 7216, "", errDesc & "<br><br>" & sqlStatement
End If
End Sub

''###############################################
''# Function dbExecute
''# Description: Execute sqlStatement on the database
''# @param sqlStatement The sqlStatement statement
''# @return The result of the execution of the sqlStatement statement
''###############################################
Public Function dbExecute(sqlStatement)
Dim errDesc


If(InStr(UCase(sqlStatement),"SELECT") <> 0) Then
Set resultSet = server.createObject("adodb.recordSet")
resultSet.CursorLocation = adUseClient

On Error Resume Next
resultSet.open sqlStatement, connection, adOpenKeySet
If Err.Number<>0 Then
errDesc = Err.Description
On Error Goto 0
Err.Raise 7216, "", errDesc & "<br><br>" & sqlStatement
End If

Set dbExecute = resultSet
Else
On Error Resume Next
Set dbExecute = connection.Execute(sqlStatement)
If Err.Number<>0 Then
errDesc = Err.Description
On Error Goto 0
Err.Raise 7216, "", errDesc & "<br><br>" & sqlStatement
End If

End If
End Function

[/FUNCTIONS]

Expand|Select|Wrap|Line Numbers
  1. ’’##  This is the code that uses the above functions
  2.  
  3. <%
  4. commentsLogger.write Request("add_action")
  5. dim  workingRS, value
  6. ''
  7. dim daSQL
  8. Set daSQL = new SQL
  9. daSQL.init()
  10. daSQL.dbConnect()
  11. ''
  12. Select Case Request("add_action")
  13. '' ## determine what to do, depending on which button the user has clicked
  14.  
  15. Case "PComments":
  16.  
  17.   If Request("db_command") = "insert" Then
  18.  
  19.     tempCom = Request("comments")
  20.  
  21.       tempComTooLong = False
  22.  
  23.  
  24.     commentsSQL.dbInsertBegin "P_Comments"
  25.     commentsSQL.addColumnValuePair "P_Comment_ID", "P_Comment_ID.NextVal"
  26.     commentsSQL.addColumnValuePair "P_ID", "" & Request("p_id") & ""
  27.     commentsSQL.addColumnValuePair "P_Comment_Date", "" & "To_Date('" & Date() & "','MM/DD/YYYY')"
  28.     commentsSQL.addColumnValuePair "P_Comment", "'" & tempCom & "'"
  29.     commentsSQL.addColumnValuePair "E_ID", "" & Session("id") & ""
  30.     commentsSQL.dbInsertEnd
  31.  
  32.  
  33.     Response.write "<center>"
  34.     Response.write "<span class=""saveConfirm"">Comment has been saved."
  35.     Response.write "</span></center><br><br>"
  36.     %>
  37.  
  38.   commentsSQL.dbUpdateBegin "P_Profiles"
  39.    commentsSQL.addColumnValuePair "GSP _Comments", "'" & tempCom & "'"
  40.    commentsSQL.dbUpdateEnd "P_ID=" & Request("p_id") & ""
  41.  
  42.  
  43. <%Case "ProcessComments":
  44.  
  45.   If Request("db_command") = "insert" Then
  46.     tempCom = ""
  47.     tempCom = Request("comments")
  48.     tempCom = "'" & tempCom & "'"
  49.  
  50. ''##  These commented out lines are how the code was originally, before attempting clob 
  51.  ''## commentsSQL.dbUpdateBegin "P_Profiles"
  52.  ''## commentsSQL.addColumnValuePair "GSP _Comments", "'" & tempCom & "'"
  53.   ''## commentsSQL.dbUpdateEnd "P_ID=" & Request("p_id") & ""
  54.  
  55.  
  56.     Set workingRS = daSQL.dbExecute("SELECT GSP_COMMENTS FROM P_PROFILES where P_ID = " & Request("p_id") & " FOR UPDATE OF GSP_COMMENTS")
  57.     value = workingRS("GSP_COMMENTS")
  58.  
  59.    ''## The following statement is what is causing the error.  I have tried it both with and
  60.    ''## without the daSQL.dbExecute
  61.  
  62.    daSQL.dbExecute("dbms_lob.writeappend value, length(tempCom), tempCom")
  63.  
  64.     workingRS.Close
  65.     Set workingRS = Nothing
  66.     Response.write "<center>"
  67.     Response.write "<span class=""saveConfirm"">Comment has been saved."
  68.     Response.write "</span></center><br><br>"
  69.     %>
  70.  
Feb 2 '08 #1
0 2882

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Philippe LAVIGERIE | last post by:
What's wrong with my sample ? SQL> select * from v$version; BANNER ---------------------------------------------------------------- Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production...
8
by: gimme_this_gimme_that | last post by:
Is there something equivalent to Oracle's SELECT DBMS_LOB.GETLENGTH(COLUMN_NAME) FROM FOO where COLUMN_NAME is a CLOB in table FOO returning an integer with a count of the number of...
1
by: tina | last post by:
Hello, I would really appreciate some help. I am still learning VBA and I feel like my brain is fried already. Below I am trying to run a query and do a loop. I actually get the data set but...
0
by: Lauren Quantrell | last post by:
I use the following code to create text edit fields and command buttons in my toolbars: Function CreateToolbarObject(myObjectType as integer) Dim newObject Select Case myObjectType Case 1...
10
by: Vi | last post by:
Hi, I'm trying to dinamically add LinkButton Controls to a web form. I do something like: for(i=1;i<=someVariable;i++) { LinkButton PageLink = new LinkButton(); PageLink.CommandName =...
5
by: Teo | last post by:
Hi! Sorry for my many postings on this Newsgroup. I am new to ADO.NET and I got Sceppa's book on ADO.NET. It's a great book but covers a lot on the DataAdapter and Offline Data. Now, if I want to...
4
by: Mythran | last post by:
I have the following code: public static void Main() { DoIt(); } private void DoIt() {
2
by: explode | last post by:
I made nova oledbdataadapter select update insert and delete command and connection veza. dataset is Studenti1data, I made it by the new data source wizard,and made datagridview and bindingsource...
10
by: jimmy | last post by:
Hi again, sorry for posting two questions so close together but im working on a school project which is due in soon and running into some difficulties implementing the database parts. I have the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.