Command Object Insert error

Hi, I am having trouble trying to figure out an error I have
with DW created Command Object. The error is below:
Microsoft OLE DB Provider for SQL Server error '80040e14'
Incorrect syntax near ')'.
/labeldivision/Customer/AddCreditCard.asp, line 37
Here is the code:
<%
if(request("NameOnCard") <> "") then Command1__Name =
request("NameOnCard")
%>
<%
set Command1 = Server.CreateObject("ADODB.Command")
Command1.ActiveConnection = MM_ASPConn_STRING
Command1.CommandText = "INSERT INTO dbo.TblCreditCard
(NameOnCard) VALUES (" + Replace(Command1__Name, "'", "''") + ") "
Command1.CommandType = 1
Command1.CommandTimeout = 0
Command1.Prepared = true
Command1.Execute()
%>
I have looked all over trying to figure this out. I think it
must e something to do with the quotes but this is exactly the way
that DW wrote it.

Check that the database field is set up to accept text.
Paul Whitham
Certified Dreamweaver MX2004 Professional
Adobe Community Expert - Dreamweaver
Valleybiz Internet Design
www.valleybiz.net
"xybernaut" <[email protected]> wrote in
message
news:ee6b9q$r13$[email protected]..
> Hi, I am having trouble trying to figure out an error I
have with DW
> created
> Command Object. The error is below:
>
> Microsoft OLE DB Provider for SQL Server error
'80040e14'
>
> Incorrect syntax near ')'.
>
> /labeldivision/Customer/AddCreditCard.asp, line 37
>
> Here is the code:
>
> <%
>
> if(request("NameOnCard") <> "") then
Command1__Name =
> request("NameOnCard")
>
> %>
> <%
>
> set Command1 = Server.CreateObject("ADODB.Command")
> Command1.ActiveConnection = MM_ASPConn_STRING
> Command1.CommandText = "INSERT INTO dbo.TblCreditCard
(NameOnCard) VALUES
> ("
> + Replace(Command1__Name, "'", "''") + ") "
> Command1.CommandType = 1
> Command1.CommandTimeout = 0
> Command1.Prepared = true
> Command1.Execute()
>
> %>
>
> I have looked all over trying to figure this out. I
think it must e
> something
> to do with the quotes but this is exactly the way that
DW wrote it.
>
>

Similar Messages

  • ORAOLEDB:Ora-2005 error with ADO command object

    Hello,
    I am using adodb.command object
    to make few insert queries in database.
    Provider is oledbora.oracle.
    Something like,
    vb sample code:
    dim varr(52)
    varr(1) = ----
    varr(2) = -----
    adodb.commandtext = xxxxxx
    call adodb.execute(,varr)
    I am receiving ora-2005 error.
    (implicit (-1) length not allowed)
    ###**** Interesting fact is, same piece
    of code is working with msdaora provider.

    Sameer, please direct OLEDB-related issues to the forum for OLEDB.

  • Using a Variable in SSIS - Error - "Command text was not set for the command object.".

    Hi All,
    I am using a OLE DB Source in my dataflow component and want to select SQL Query from the master table  I have created variables v_Archivequery
    String packageLevel (to store the query).
    <Variable Name="V_Archivequery" DataType="String">
         SELECT a.*, b.BBxKey as Archive_BBxKey, b.RowChecksum as Archive_RowChecksum
         FROM dbo.ImportBBxFbcci a LEFT OUTER JOIN Archive.dbo.ArchiveBBxFbcci b
         ON (SUBSTRING(a.Col001,1,4) + SUBSTRING(a.Col002,1,10)) = b.BBxKey
         Where (b.LatestVersion = 1 OR b.LatestVersion IS NULL)
        </Variable>
    I am assigning this query to the v_Archivequery variable, "SELECT a.*, b.BBxKey as Archive_BBxKey, b.RowChecksum as Archive_RowChecksum
    FROM dbo.ImportBBxFbcci a LEFT OUTER JOIN Archive.dbo.ArchiveBBxFbcci b
     ON (SUBSTRING(a.Col001,1,4) + SUBSTRING(a.Col002,1,10)) = b.BBxKey
    Where (b.LatestVersion = 1 OR b.LatestVersion IS NULL)"
    Now in the OLE Db source, I have selected as Sql Command from Variable, and I am getting the variable, v_Archivequery .
    But when I am generating the package and when running I am getting bewlo errror
     Error at Data Flow Task [OLE DB Source [1]]: An OLE DB error has occurred. Error code: 0x80040E0C.
    An OLE DB record is available.  Source: "Microsoft SQL Native Client"  Hresult: 0x80040E0C  Description: "Command text was not set for the command object.".
    Can Someone guide me whr am going wrong?
    Please let me know where am going wrong?
    Thanks in advance.
    Thankx & regards, Vipin jha MCP

    What happens if you hit Preview button in OLE DB Source Editor? Also you can use the same query by selecting SQL Command option and test.
    Could you try set the Delay Validation = True at Package and re-run ?
    If set the query in variable expression (not in value), then Set Evaluate As Expression = True.
    -Vaibhav Chaudhari

  • Command to insert or update database error

    I'm using DW CS4. Every time I create a new command to insert or update a record the generated code is invalid. The error is at the line that suppose to have all variables just before the adodb command and looks like this:
    <%
    ' IIf implementation
    Function MM_IIf(condition, ifTrue, ifFalse)
      If condition = "" Then
        MM_IIf = ifFalse
      Else
        MM_IIf = ifTrue
      End If
    End Function
    Dim insNewCalComm__@@varName@@
    insNewCalComm__@@varName@@ = "@@defaultValue@@"
    If (@@runtimeValue@@ <> "") Then
      insNewCalComm__@@varName@@ = @@runtimeValue@@
    End If
    %>

         try {
                   executeInsert();
              catch(Exception e){ /*duplicate key error if exists*/
              try {
                   executeUpdate();
              catch(Exception p){ /*another error*/
              System.out.println( e.getMessage());
              System.out.println( p.getMessage());
         }     

  • Creating a LOV by using a Command Object

    Hello All,
    I have a report that's driven by a parameterized sproc, which is a year parameter.  However, we have a table that I would like to use in my object command to populate this parameter with the values from the select statement to enforce consistency. A new year is inserted into to this table yearly by another process, which would keep me from having to go into a static list to update the year options yearly. 
    I've created the command object and saved it to the repository, but I can't figure out how to associate it to the report as the parameter.
    Can anyone point me in the right direction?
    Thanks in advance.

    hi DevinM,
    two choices:
    A) add the Command to your report
    1) you can add the Command to your report...don't link it to any tables though...you'll get a "Generally not supported error" but you can ignore it for this test
    2) now in your prompt you will have the Command available for the dynamic values
    3) check that the number of records on your report remains the same as before...it should...any test i have run on this is aok
    B) create a Business View
    1) go into the Business View Manager and create a business view from the data foundation up
    2) once you've got the business view built you can create an LOV from there which is available to your current report and all other reports
    jw

  • Multiple queries in single command object

    Hi All,
    My report uses a command object, which executes an insert query. I want to do 'collect' statistics after the insert query. How to do this in a single command object. Kindly suggest me the possibilities.
    Thanks in advance!
    Meena

    Ido, when I attempt to nest an insert statement followed by a select statement in the same command object, I get a "SQL Command not properly ended" error.
    Here is the SQL:
    insert into testing123 values (sysdate, 4)
    select * from testing123
    If use semicolons to separate the two statement, I get an "Invalid Character" error.
    Here is the SQL:
    insert into testing123 values (sysdate, 4);
    select * from testing123
    Any thoughts on what I might be doing wrong here?
    Thanks!
    Chad

  • Question re Command Object to populate parameter drop-down

    I have a report that uses a SQL Server stored procedure as the data source. The first parameter they enter is their company number (we have numerous clients using Lawson and access Crystal through LBI). The next parameter is the account number. I have a SQL statement written that gets distinct account numbers by company. When I create a Command object with the SQL statement, it doesn't allow me to use the company parameter.
    SELECT DISTINCT GLC.ACCOUNT, GLC.ACCOUNT_DESC
    FROM dbo.GLMASTER AS GLM
    INNER JOIN DBO.GLCHARTDTL AS GLC
    ON GLM.CHART_NAME = GLC.CHART_NAME
    AND GLM.ACCOUNT = GLC.ACCOUNT
    WHERE GLM.COMPANY = {?Company}
    ORDER BY GLC.ACCOUNT
    When I do Add Command in Database Expert and add the SQL above and name the parameter and try to Add, it says "Failed to retrieve data from the datase.
    Details: ADO Error Code: 0x
    Source: Microsoft OLE DB Provider for SQL Server
    Description: No value given for one or more required parameters
    Does anyone have a similar situation and a solution to this problem--either regarding my approach and error or a different approach to get the same thing?
    Any input would be greatly appreciated!

    You can't do this through a command object.  This particular type of parameter is called a "Cascading Dynamic Prompt".  You have to set these up through a Crystal Business View. 
    -Dell

  • Using Crystal Reports formulas in Command Objects

    Post Author: Hamish
    CA Forum: Formula
    Is this possible?
    When I try and reference a formula in a command object
    something like
    select * from tablenamewhere id in (@testFormula)
    @testFormula prints out as 1,2 on the report if I remove the reference in the command object
    I get an error Incorrect syntax near @testFormula from SQL Server
    (I'm using CR XI and SQL Server 2005)

    Post Author: bryanflora
    CA Forum: Formula
    In a matter of fact, Formula is for you to calculate the result you get from DB.And if there's anything you want to pass to DB before you get result, it's Parameter.

  • SQL Command Object

    We are in the process of migrating reports from SSRS to Crystal 2011.
    In SSRS we are able to paste complex SQL into reports as the data source for the report (e.g. multiple CTE's, correlated subqueries, temp tables, etc).
    It appears that we can accomplish the same thing using Crystal command objects, but the reports created have to be distributed as stand-alone rpt files to customers. In that case the reports that use sql commands return an error that the command object does not exist. It seems the command object exists in the data connection (which is generated at run-time in the host application) and not in the rpt file itself.
    Is it possible to somehow use an sql query as the data source in the report in a manner that is independent of the data connection?
    Thanks

    Hi, 
    That's interesting, the query shouldn't be stored in the data connection.  It should be saved inside the rpt as part of the SQL Query. 
    How are you distributing the reports? 
    How is your application connecting the reports to the database? 
    As long as the reports logon to the tables and objects used in the SQL Command exist on the database it should run without a problem. 
    As a test, open the report in Crystal and go to Database | Show SQL Query.  You should see your SQL Command there.  Copy and paste the SQL into your production database and see if it runs. 
    Good luck,
    Brian

  • Bar chart get "Object required" error

    I create a bar char which group by Data Time filed, I uncheck "Continuous time Series", select "Use time groups" and select Hour(Quantity=2).
    Count another filed as chart values.
    View the report. If I insert a time which in an un-existed series, it will get "Object required" error.
    e.g: if there are time : 6:00, 4:00, when i insert a time 6:00, it works well, but if i insert a time 2:00, it get error

    Jeffrey,
    Did you manage to find a workaround for this? Or has it been confirmed as bug?
    Reason I ask is because I am facing the same problem, but with a line graph (also using time series). I am also using 11.1.12. I only get the error when the chart is receiving its first value i.e. the chart is in 'No Values' state, but then data is inserted into the Data Object, which will then update the View Object for the first time.
    After I click 'reprompt', everything is back to normal and the view object displays the correct output following the insertion of the data into the data object. Subsequent data in the data object is then correctly picked up and displayed. The problem seems to be the initial data values.
    Regards

  • VBA Runtime Error 1004 "Application-defined or Object-defined error"

    I have code VBA code written in MS Access 2010 (.mbd file) to write data into an Excel file (.xls file). Below is the code to write data into that excel file. When you run this code, it always throws Error#1004 "Application-defined or Object-defined
    error". When you debug the code (F8) or run it (F5), it runs absolutely fine with out any issues. I am still not able to figure it out on what exactly the issue is. This code works fine when executed in MS Access 2007.
    Below is thr code that's getting executed and when it fails, the focus is set on the 3rd last line of the code marked in double astriek mark.
    Sub PopulateReport(appExcel As Object, testcam)
    Dim Site As String, intRec As Integer, i As Integer, cnt As Integer, intRecSet As Integer, cntr As Integer
    Dim F1 As String, F2 As String, F3 As String, F4 As String, F5 As String, F6 As String, F7 As String
    Dim F8 As String, F9 As String, F10 As String, F11 As String, F12 As String, F13 As String, CAMDate As Date
    Close
    i = 0
    cnt = 0
    cntr = 0
    Set cnn = CurrentProject.Connection
    rec.Open "SELECT * FROM Site", cnn, adOpenStatic, adLockPessimistic
    rec.MoveLast
    rec.MoveFirst
    intRec = rec.RecordCount
    Do Until cnt = intRec
    rec.MoveLast
    rec.MoveFirst
    rec.Move cnt
    Site = rec(4)
    Select Case Site
    Case "Fort Worth"
    cntr = 0
    recset.Open "SELECT * FROM Employee", cnn, adOpenStatic, adLockPessimistic
    recset.MoveLast
    recset.MoveFirst
    intRecSet = recset.RecordCount
    appExcel.Application.Goto Reference:="START_FW_CL"
    Do Until cntr = intRecSet - 1
    appExcel.Selection.EntireRow.Copy
    appExcel.Selection.EntireRow.Insert
    cntr = cntr + 1
    Loop
    appExcel.Application.CutCopyMode = False
    appExcel.Application.Goto Reference:="START_FW2_CL"
    go = appExcel.Application.Range("START_FW2_CL")
    cntr = 1
    With appExcel.Worksheets("Accts. > Clearing").[START_FW2_CL]
    Do Until recset.EOF
    **.Offset(cntr, 0) = recset(0)**
    .Offset(cntr, 1) = recset(1)
    .Offset(cntr, 2) = recset(2)
    End Sub

    What's wrong about it? It can only copy what you chose to have in the recordset. If you only want some fields or fields in a different order, replace
    SELECT * FROM  with
    SELECT Field1, Field2, etc
    CopyFromRecordset is bay far the best method and runs much faster.
    Rod Gill
    Author of the one and only Project VBA Book
    www.project-systems.co.nz

  • Oracle 8i Lite: Command Object Creation Failed

    Hi Everyone,
    I use Windows XP everything works except navigator and I get the message that Command Object Creation Failed
    Does Anyone know how to fix this and I have to use 8i Lite as it for a school database project
    Thanks in advance for everyone's help
    J S

    Hi. I know this response is too many years late, but I'm putting it in case someone (like me a few days ago) needs to connect to a legacy server using legacy tools:
    This error is caused by the installer, sometimes it does not adequately register the OLE/COM objects provided in nav8cmd.dll
    So, to correct it:
    - open a command window
    - change to the directory where the navigator program files reside (In my case c:\orant\bin)
    - type the following command: regsvr32 nav8cmd.dll
    You should receive a message that the DLL was correctly registered. After that you can use the navigator without problems.
    Cheers.

  • Set Table Location for Reports(Command Objects)

    Hi SAP Gems,
    I would like to thank TED,Merry,Jonathan, Shawn, and all the developers contributing to this community.
    I would really appreciate any help on following question:
    1. I have a report designed in CR 2008 against DB2(JDBC Connectivity).
    2. The report is working fine in the designer.
    3. There are five sub reports in the main report.
    4. The main report doesnt have any command object however every child/sub report has command object with paramaters.
    5. Every subreport is linked.
    6. I would like to change runtime datasource location for this report using CRJ 2.0 SDK'S.( from AIX to Windows BOX)
    7. Both BOX's have same database schema.
    8. I am able to view the report in the jsp page using SDK's, however "set table location doesnt works and prompts me the error:
    com.crystaldecisions.sdk.occa.report.lib.ReportSDKException: Unexpected database connector error---- Error code:-2147467259 Error code name:failed
    *There is no problem with the code because the sample code is taken from sdn.sap as it is and it works for other report without subreport and command objects.
    I tried using the following code piece but again same problem.
    if(table instanceof com.crystaldecisions.sdk.occa.report.data.CommandTable)
                        IProcedure command = (IProcedure)table;
                        ParameterField commandParam = (ParameterField) command.getParameters().get(0);
                        Values values = new Values();
                        ParameterFieldDiscreteValue pfdv = new ParameterFieldDiscreteValue();
                        pfdv.setValue("ANTON");
                        values.add(pfdv);
                        commandParam.setCurrentValues(values);
    I would like to know if I dont want to set the command level param using:
    ParameterField commandParam = (ParameterField) command.getParameters().get(0);
                        Values values = new Values();
                        ParameterFieldDiscreteValue pfdv = new ParameterFieldDiscreteValue();
                        pfdv.setValue("ANTON");
                        values.add(pfdv);
                        commandParam.setCurrentValues(values);
    would the parameter would be prompted automatically?
    how do I find what paramaeter to set and how ?
    Regards,
    Jonathan Roy

    Hi ,
    Can any one help please?
    Ted !! I would really appreciate an answer from you.
    Regards,
    Jon

  • Command Object Source

    I have recently moved from Dreamweaver MX (2003) to CS3. In
    MX, a recordset object was used to query the database. To
    troubleshoot a query,
    Dim SelectedPrimary
    Dim SelectedPrimary_numRows
    Set SelectedPrimary = Server.CreateObject("ADODB.Recordset")
    SelectedPrimary.ActiveConnection = MM_connClusterDB_STRING
    SelectedPrimary.Source = "SELECT O.OfficeID, O.ShortOffice
    FROM tbl_Offices O WHERE OfficeID = '" +
    Replace(SelectedPrimary__OffID, "'", "''") + "' ORDER BY
    OfficeName"
    SelectedPrimary.CursorType = 0
    SelectedPrimary.CursorLocation = 2
    SelectedPrimary.LockType = 1
    SelectedPrimary.Open()SelectedPrimary_numRows = 0
    before "SelectedPrimary.Open()" I would add...
    Response.Write SelectedPrimary.Source
    Response.End()
    run the page and copy the code (
    SELECT O.OfficeID, O.ShortOffice FROM tbl_Offices O WHERE
    OfficeID = 7 ) into Query Analyzer
    Is there a similar function to write out the code to a page
    for troubleshooting a Command Object query that is used in
    Dreamweaver CS3?
    Other than repeatedly filling out the 4 items (Name, Type,
    Value and Default value) over and over,
    how do you make the Command Object to use the same variable,
    several times in one query?
    Dreamweaver CS3 | ASP | SQL SERVER
    -- Steve

    Stevan2002 wrote:
    > before "SelectedPrimary.Open()" I would add...
    >
    > Response.Write SelectedPrimary.Source
    > Response.End()
    >
    > run the page and copy the code (
    SELECT O.OfficeID, O.ShortOffice FROM
    > tbl_Offices O WHERE OfficeID = 7 ) into Query
    Analyzer
    >
    > Is there a similar function to write out the code to a
    page for
    > troubleshooting a Command Object query that is used in
    Dreamweaver CS3?
    Unfortunately as far as I'm aware, with the command object
    and the parameters it uses you can't get the actual SQL that is
    submitted to the database, you can only get the SQL with the ?
    tokens where the values are supposed to be inserted. However, if
    you want to try to recreate the generated SQL, try something like
    the following. Look for this line of code:
    Set Recordset1 = Recordset1_cmd.Execute
    Just above it add the following (substitute your recordset
    name for Recordset1 below):
    ' Should work for Access and SQL Server, other DBs are
    questionable
    Dim cmd : Set cmd = Recordset1_cmd
    Dim cmdSQL: cmdSQL = cmd.CommandText
    Dim cmdParam
    for each param in cmd.Parameters
    val = param.Value
    If(param.Type = 200) Then ' If text
    val = """" & val & """"
    End If
    If(param.Type = 135) Then ' If date
    val = "'" & val & "'"
    End If
    cmdSQL = Replace(cmdSQL, "?", val, 1, 1)
    next
    Response.Write(cmdSQL &"<br />")
    Note this likely will only work with Dreamweaver parameters
    created within the Recordset dialog.
    > Other than repeatedly filling out the 4 items (Name,
    Type, Value and Default
    > value) over and over,
    > how do you make the Command Object to use the same
    variable, several times in
    > one query?
    Within the Dreamweaver UI, that's the way you do it. If you
    want to do it in the code, you can copy and paste the parameter
    code above the recordset, change the name slightly, like appending
    2, 3, then 4. Then you'd need to add an extra Parameters and update
    the "param1" to 2, 3, and 4.
    Danilo Celic
    | Extending Knowledge Daily :
    http://CommunityMX.com/
    | Adobe Community Expert

  • Removing Command Object

    I still consider myself a beginner at Crystal Reports (XI), even though I've had some successes.  I know I lucked out in getting my reports done and probably couldn't tell you exactly how I actually did them.  I appreciate any help and apologize if I missed something obvious. 
    What I'm trying to do now is update the reports I was able to first create.  I want to add several more tables and fields.  Also, because the original reports are using a command object, they ran very slowly.  I want to remove the command object and query the database directly.  I can do that, right?  Well, I did that first thinking this would be the easy part - but I'm not sure if I did it correctly - basically deleting the command object and updating the formula fields to pull directly from the tables. I also went through the Set Database location to update to the new tables and then verified the database.  In the Field Explorer, I can browse the data, but when previewing the report no data is returned.  There is no error messages.  I'm connecting to the database (SQL) via OLE. 
    Can someone help fill me in on what I missed?

    Hi,
        Well, you need to create the new query/view first.
    Make sure that it contains all the fields you are presently using (...plus the new fields).  Make sure the Date Types are the same as the old fields that you want to replace.  Even name the fields the same as in the command object. (... with an "AS" clause...table.field as "Order ID"). 
        Now add the new view to the report.  This should activate the "Mapping" feature.  The "Mapping" dialog will show you what mapping it thinks is right and which ones it can't figure out.  Check them all out, map the new fields to the old fields and click ok.  Now you can add the new fields you created because they will show up under "Database" in your report.
    Make sure all the old fields are replaced by the new ones. 
    You can tell because all the check marks beside the old fields will be gone.  When the fields are all replaced, you can delete the old command object.
         If you miss a step or don't do one of the steps right, the mapping feature will not come up when you add the new view.
    I don't know of another way to force the mapping feature to appear.  Maybe someone else knows.
    Happy Hunting,
    The Panda

Maybe you are looking for

  • Acrobat PDF Portfolio - Not Saving my Welcome Page or Header

    For some reason, I can't get my Welcome Page or Header to save when I'm creating a PDF Portfolio.  What am I missing? It shows up fine when I create it but then I save and close and reopen and they aren't there... Please Help!

  • Decimal places in a query

    Hi all, How to set in a query the decimal places in 3? For example: 1,006 Edited by: Philip Eller on Jun 18, 2008 9:23 AM

  • How to edit asp tag in CS5

    Greetings, Sorry, very new to asp. I'm trying to edit the asp tags seen under the ASP:DataList section. Not only can I not seem to open the tags, but when I view the page source on the web, I see what must be the text from the asp tags. When I view t

  • Deleting images from hard drive

    My hard drive warned me its capacity if almost full, so I deleted bunches of photos, but it made little difference in the amount of available space. Does this mean all my deleted images are still deep in there somewhere taking up space? If so, how do

  • How do I add vido to my flex application?

    I been trying to use VideoDisplay, but some how it only shows me black window and not playing after I am using the play() function.