Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > General Computer Discussion > Software > DataKeyNames Update

Reply
Thread Tools

DataKeyNames Update

 
 
brunavillar brunavillar is offline
Junior Member
Join Date: Apr 2007
Posts: 1
 
      04-27-2007
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.SqlDataSourceCommandEven tArgs)
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


<aspetailsView ID="DetailsView1" runat="server" DataSourceID="sdsPrincipal" AllowPaging="True"
OnItemUpdating="DetailsView1_ItemUpdating"
DataKeyNames="HOST_ID,DB_ID" CssClass="DetailsView1"
OnItemCommand="DetailsView1_ItemCommand" OnPageIndexChanging="DetailsView1_PageIndexChangin g"
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>
<aspropDownList 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> </aspropDownList>

</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>
<asparameter Type="Int32" Name="PRM_HOST_ID"></asparameter>
<asparameter Type="Int32" Name="PRM_DB_ID"></asparameter>
</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" />
<asparameter Type="Int32" ConvertEmptyStringToNull="false" Name="PRM_DB_ID"></asparameter>
</UpdateParameters>


PLEASE!!! HELP!!!!!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP.NET 2.0 objectdatasource and datakeynames with gridview rgparkins ASP .Net 2 10-05-2007 10:54 AM
extra DataKeyNames - Stored procedure too many arguments ?? jobs ASP .Net 0 11-30-2006 02:31 AM
Using gridview datakeynames with muliple keys question needin4mation@gmail.com ASP .Net 0 10-11-2006 06:34 PM
SqlDataSource not getting update when using DataKeyNames rlueneberg@gmail.com ASP .Net 1 02-13-2006 04:08 PM
GridView & DataKeyNames Robert Warnestam ASP .Net 0 10-11-2004 11:28 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57