locked
Database Error RRS feed

  • Question

  • User-740453238 posted

    I have the following that gives me an error: The first one does not work the second one does.  Can someone tell me what I am doing wrong.  I am using VS to hit a Informix Database.

        <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:InformixCS2012 %>" ProviderName="<%$ ConnectionStrings:InformixCS2012.ProviderName %>" SelectCommand="SELECT [item_serial], [po_num], [amount], [tax_amount], [item_bgt], [item_desc], [budget_year], [month_ap] FROM [dbs.payable_detail] WHERE ([db_acct] = ?)">
            <SelectParameters>
                <asp:ControlParameter ControlID="GridView1" Name="db_acct" PropertyName="SelectedValue" Type="String" />
            </SelectParameters>
        </asp:SqlDataSource>
       
    But it works without the where.  Im’ getting this error: ERROR [42000] [Informix][Informix ODBC Driver][Informix]A syntax error has occurred.
    Tuesday, March 6, 2012 1:10 PM

All replies

  • User2097818059 posted
    WHERE ([db_acct] = ?)

    Should be:

    WHERE ([db_acct] = @db_acct)
    Tuesday, March 6, 2012 1:24 PM
  • User-740453238 posted

    I was able to get the first one to work by removing the ([ brackets.  However, I am now trying to get a different one to work.  Here is the new one I need help with.  Any Takers?  I'm pretty sure I have to get rid of the fi. as VS adds that but it's still not working.

       <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:InformixCS2012 %>" ProviderName="<%$ ConnectionStrings:InformixCS2012.ProviderName %>" SelectCommand="SELECT fi.dbs.payable_detail.item_serial, fi.dbs.payable_detail.db_acct, fi.dbs.payable_detail.po_num, fi.dbs.payable_detail.amount, fi.dbs.payable_detail.item_bgt, fi.dbs.payable_detail.item_desc, fi.dbs.payable_detail.budget_year, fi.dbs.payable_detail.month_ap, fi.dbs.payable_master.lastname, 'month_ap || / || budget_year' AS date; FROM fi.dbs.payable_detail, fi.dbs.payable_master WHERE fi.dbs.payable_detail.master_key = fi.dbs.payable_master.unique_key AND fi.dbs.payable_detail.db_acct = ?">
                <SelectParameters>
                    <asp:ControlParameter ControlID="GridView1" Name="?" PropertyName="SelectedValue" />
                </SelectParameters>
            </asp:SqlDataSource>
    Wednesday, March 7, 2012 8:24 AM
  • User-1360095595 posted

    What is that semi colon before FROM!?

    Wednesday, March 7, 2012 8:27 AM