DataKeyNames Update

Discussion in 'Software' started by brunavillar, Apr 27, 2007.

  1. brunavillar

    brunavillar

    Joined:
    Apr 27, 2007
    Messages:
    1
    I have a detailsview with 2 datakeynames, host_id and db_id. When I edit the registry I can modify the host_name, so I have to modify the host_id too. But when I update the host_id continue the same. I'm using stored procedures, and its right. what do i do?!?!?!?! Here is the code...

    Private Sub sdsPrincipal_Updating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceCommandEventArgs)
    For x As Integer = 0 To e.Command.Parameters.Count - 1
    Trace.Write(e.Command.Parameters(x).ParameterName)
    Trace.Write(e.Command.Parameters(x).Value)
    Next


    e.Command.Parameters("@HOST_ID").Value = e.Command.Parameters("@PRM_HOST_ID").Value
    e.Command.Parameters.Remove(e.Command.Parameters("@DB_DESC"))
    e.Command.Parameters.Remove(e.Command.Parameters("@HOST_ID"))
    e.Command.Parameters.Remove(e.Command.Parameters("@DB_VENDOR"))
    e.Command.Parameters.Remove(e.Command.Parameters("@DB_TYPE"))
    e.Command.Parameters.Remove(e.Command.Parameters("@DB_OBS"))

    End Sub


    <asp:DetailsView ID="DetailsView1" runat="server" DataSourceID="sdsPrincipal" AllowPaging="True"
    OnItemUpdating="DetailsView1_ItemUpdating"
    DataKeyNames="HOST_ID,DB_ID" CssClass="DetailsView1"
    OnItemCommand="DetailsView1_ItemCommand" OnPageIndexChanging="DetailsView1_PageIndexChanging"
    AutoGenerateRows="False" CellPadding="4" ForeColor="#333333" GridLines="None" Width="347px">
    <FooterStyle BackColor="#507CD1" ForeColor="White" CssClass="DetailsViewFooter" Font-Bold="True"></FooterStyle>

    <CommandRowStyle BackColor="#D1DDF1" Font-Bold="True"></CommandRowStyle>

    <EditRowStyle BackColor="#2461BF" CssClass="DetailsViewEdit"></EditRowStyle>

    <RowStyle BackColor="#EFF3FB"></RowStyle>

    <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center"></PagerStyle>
    <Fields>
    <asp:TemplateField><EditItemTemplate>
    Edit Mode

    </EditItemTemplate>
    <InsertItemTemplate>
    Insert Mode

    </InsertItemTemplate>
    <ItemTemplate>
    Readonly Mode

    </ItemTemplate>
    </asp:TemplateField>

    <asp:TemplateField HeaderText="HOST_DESC">

    <EditItemTemplate>
    <asp:SqlDataSource id="sdsHosts" runat="server" SelectCommand="SELECT [HOST_ID], [HOST_DESC] FROM [HOST]" ConnectionString="<%$ ConnectionStrings:SupInfraConnectionString %>" CancelSelectOnNullParameter="False"></asp:SqlDataSource>
    <asp:DropDownList id="ddlHosts" runat="server" DataValueField="HOST_ID" DataTextField="HOST_DESC" AppendDataBoundItens="true" DataSourceID="sdsHosts" SelectedValue='<%# Eval("HOST_ID") %>' AutoPostBack="true">
    <asp:ListItem Value="">Selecione um HOST</asp:ListItem> </asp:DropDownList>

    </EditItemTemplate>


    <asp:SqlDataSource ID="sdsPrincipal" runat="server" ConnectionString="<%$ ConnectionStrings:SupInfraConnectionString %>"
    DeleteCommand="SP_DATABASE_DEL" DeleteCommandType="StoredProcedure" InsertCommand="SP_DATABASE_INS"
    InsertCommandType="StoredProcedure" SelectCommand="SP_DATABASE_SEL" SelectCommandType="StoredProcedure"
    UpdateCommand="SP_DATABASE_UPD" UpdateCommandType="StoredProcedure" OnInserted="sdsPrincipal_Inserted" OnInserting="sdsPrincipal_Inserting" OnUpdating="sdsPrincipal_Updating" CancelSelectOnNullParameter="False" OldValuesParameterFormatString="PRM_{0}">
    <DeleteParameters>
    <asp:parameter Type="Int32" Name="PRM_HOST_ID"></asp:parameter>
    <asp:parameter Type="Int32" Name="PRM_DB_ID"></asp:parameter>
    </DeleteParameters>
    <UpdateParameters>
    <asp:ControlParameter Type="String" Name="PRM_DB_TYPE" ControlID="DetailsView1$ddlDB_TYPE" PropertyName="SelectedValue" />
    <asp:ControlParameter Type="String" Name="PRM_DB_DESC" ControlID="DetailsView1$txtDB_DESC" />
    <asp:ControlParameter Type="String" Name="PRM_DB_VENDOR" ControlID="DetailsView1$ddlDB_VENDOR_upd" PropertyName="SelectedValue" />
    <asp:ControlParameter Type="String" Name="PRM_DB_OBS" ControlID="DetailsView1$txtDB_OBS" />
    <asp:ControlParameter Type="Int32" Name="PRM_HOST_ID" ControlID="DetailsView1$ddlHosts" PropertyName="SelectedValue" />
    <asp:parameter Type="Int32" ConvertEmptyStringToNull="false" Name="PRM_DB_ID"></asp:parameter>
    </UpdateParameters>


    PLEASE!!! HELP!!!!!
     
    brunavillar, Apr 27, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ch.Kalyana Krishna

    NSW 2003. Live Update Common Client Update Fails

    Ch.Kalyana Krishna, Jun 27, 2003, in forum: Computer Support
    Replies:
    1
    Views:
    921
    Administrator
    Jun 27, 2003
  2. lbbss

    avg update is taking so far 20hrs to update,

    lbbss, Feb 12, 2005, in forum: Computer Support
    Replies:
    1
    Views:
    843
    Blinky the Shark
    Feb 13, 2005
  3. Greg Onyshczak

    Windows Update & Microsoft Update

    Greg Onyshczak, Jul 28, 2005, in forum: Computer Support
    Replies:
    2
    Views:
    651
    SgtMinor
    Jul 28, 2005
  4. Adriano

    Windows Update not update IE, why?

    Adriano, Sep 5, 2004, in forum: Computer Information
    Replies:
    1
    Views:
    541
  5. Lawrence D'Oliveiro

    Update On The Windows Phone 7 Update Update

    Lawrence D'Oliveiro, Feb 24, 2011, in forum: NZ Computing
    Replies:
    2
    Views:
    578
    Another Me
    Feb 25, 2011
Loading...

Share This Page