I've looked at all the posts on this topic, and I'm sure it's something that I'm doing or not doing, but for the life of me I can't see it. I'm using Visual Studio 2005 with VB.NET to write ASP.NET pages for an Oracle 10 database.
The SELECT command is a join and I had to hand-code it because the QueryBuilder kept giving errors when I tried to create a join. It works fine. The problem is with the DELETE command.
Here's my GridView code:
1 <asp:GridView ID="GridViewL2" runat="server"
2 Style="position: static" CellPadding="4" ForeColor="#333333" GridLines="None" AllowSorting="True" AutoGenerateColumns="False" DataSourceID="SqlDataSource1">
3 <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
4 <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
5 <EditRowStyle BackColor="#999999" Font-Bold="True" />
6 <SelectedRowStyle BackColor="LightYellow" Font-Bold="True" ForeColor="#333333" />
7 <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
8 <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
9 <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
10 <Columns>
11 <asp:BoundField DataField="PARENT" HeaderText="PARENT" SortExpression="PARENT" />
12 <asp:BoundField DataField="CHILD" HeaderText="CHILD" SortExpression="CHILD" />
13 <asp:BoundField DataField="POSITION" HeaderText="POSITION" SortExpression="POSITION" />
14 <asp:BoundField DataField="LASTLEVEL" HeaderText="LASTLEVEL" SortExpression="LASTLEVEL" />
15 <asp:BoundField DataField="DOCUMENT" HeaderText="DOCUMENT" SortExpression="DOCUMENT" />
16 <asp:BoundField DataField="PARENTPOS" HeaderText="PARENT POS" SortExpression="PARENTPOS" Visible="False"/>
17 <asp:BoundField DataField="COMPANY" HeaderText="COMPANY" SortExpression="COMPANY" />
18 <asp:BoundField DataField="PARENTID" HeaderText="PARENT ID" SortExpression="PARENTID" />
19 <asp:BoundField DataField="NODEID" HeaderText="NODEID" SortExpression="NODEID" />
20 <asp:CommandField ButtonType="Button" ShowEditButton="True" />
21 <asp:CommandField ButtonType="Button" ShowDeleteButton="True" />
22 </Columns>
23 </asp:GridView>
Here's the SqlDataSource:
1 <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ADV_MS_ConnStr %>"
2 ProviderName="System.Data.OracleClient" OldValuesParameterFormatString="Original_{0}" ConflictDetection="OverwriteChanges"
3 SelectCommand="SELECT L1.ADV_NODETEXT AS PARENT, L2.ADV_NODETEXT AS CHILD, L2.ADV_POSITION AS POSITION, L2.ADV_LASTLEVEL AS LASTLEVEL, L2.ADV_DOCUMENT AS DOCUMENT, L1.ADV_POSITION AS PARENTPOS, L2.COMPANY_CODE AS COMPANY, L1.ADV_LEVELID AS PARENTID, L2.ADV_LEVELID AS NODEID FROM ADV_LEVEL2 L2, ADV_LEVEL1 L1 WHERE (L2.ADV_PARENTID = L1.ADV_LEVELID) AND (L1.COMPANY_CODE = L2.COMPANY_CODE) ORDER BY L1.ADV_POSITION, L2.ADV_POSITION"
4 DeleteCommand="DELETE FROM ADV_LEVEL2 WHERE (COMPANY_CODE = :COMPANY) AND (ADV_PARENTID = :PARENTID) AND (ADV_LEVELID = :NODEID)" >
5 <DeleteParameters>
6 <asp:Parameter Name="COMPANY" Size="10" Type="String" Direction="InputOutput" />
7 <asp:Parameter Name="PARENTID" Size="3" Type="Decimal" Direction="InputOutput" />
8 <asp:Parameter Name="NODEID" Size="3" Type="Decimal" Direction="InputOutput" />
9 </DeleteParameters>
10 </asp:SqlDataSource>
I added DataKeyNames to the GridView. Then it started to give me ORA-01035: illegal variable name/number.
I very much appreciate the time you take to look at this code.
-sajala