none
illegal variable name/number error working on Oracle DB with VS 2008 RRS feed

  • Question

  • Hello,

    I am trying to integrate between Visual studio 2008 and Oracle 10g DB. I would like to define Update command from Gridview to Oracle using SqlDataSource with ProviderName System.Data.OracleClient , but each time I update the field in the Gridview , I get the "illegal variable name/number" error.

    The SELECT statement works fine.

    I had noticed that my column definition in the DB is varchar2(20) while the definition in the VS is string.

    Can this difference in definitions cause the problem?

    The code is as follows:

     

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="DB_Operation.aspx.vb" Inherits="DB_Operation" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">

    <head runat="server">

    <title>DB Integration</title>

    </head>

    <body>

    <form id="form1" runat="server">

    <div>

    <asp:SqlDataSource ID="SqlDataSource2" runat="server"

    ConnectionString="<%$ ConnectionStrings:ConnectionString %>"

    ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>"

    SelectCommand="SELECT &quot;ID&quot;, &quot;NAME&quot; FROM &quot;CITY&quot;"

    UpdateCommand="UPDATE CITY SET NAME = Stick out tongueARAM1 WHERE (ID = Stick out tongueARAM2)">

    <UpdateParameters>

    <asp:Parameter DefaultValue="London" Name="PARAM1" Type="String" />

    <asp:Parameter DefaultValue="1" Name="PARAM2" Type="Int32" />

    </UpdateParameters>

    </asp:SqlDataSource>

    <br />

    </div>

    <asp:GridView ID="GridView1" runat="server" AllowSorting="True"

    AutoGenerateColumns="False" BackColor="White" BorderColor="#E7E7FF"

    BorderStyle="None" BorderWidth="1px" CellPadding="3"

    DataSourceID="SqlDataSource2" GridLines="Horizontal"

    AutoGenerateEditButton="True" style="text-align: left">

    <FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />

    <RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />

    <Columns>

    <asp:BoundField DataField="ID" HeaderText="ID" SortExpression="ID" />

    <asp:BoundField DataField="NAME" HeaderText="NAME" SortExpression="NAME" />

    </Columns>

    <PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />

    <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />

    <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />

    <AlternatingRowStyle BackColor="#F7F7F7" />

    </asp:GridView>

    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

    </form>

    </body>

    </html>

     

    Please helpn defining the correct settings to enable the update command.

     

    BR,

    Michael.

     

    Saturday, November 22, 2008 11:31 AM