как отладить команду update в gridview
От: Аноним  
Дата: 23.06.07 10:51
Оценка:
Не работает команда update, после выполнения значение в таблице которое должна менять, сбрасывает в null.
Код вот такой:


    <asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource_Computers" AutoGenerateColumns="False"  DataKeyNames="CompID">
        <Columns>
            <asp:BoundField DataField="CompID" HeaderText="CompID" SortExpression="CompID" ReadOnly="True" Visible="False" />
            <asp:TemplateField HeaderText="Param1" SortExpression="Param1ID">
                <EditItemTemplate>
                    <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSource_Props"
                        DataTextField="Param1Name" DataValueField="Param1ID" SelectedValue='<%# Bind("Param1ID") %>'>
                    </asp:DropDownList>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("Param1Name") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource_Computers" runat="server" ConnectionString="Data Source=.\SQLEXPRESS;Initial Catalog=test1;Integrated Security=True;Pooling=False"
        ProviderName="System.Data.SqlClient" 
SelectCommand=
"
select t1.CompName,
       t4_1.ParamName as Param1Name,
       t4_1.ParamID as Param1ID,
       t4_2.ParamName as Param2Name
from t1 inner join t2 on t1.CompID = t2.CompID
inner join t3 on t1.CompID = t3.CompID
inner join t4 t4_1 on t4_1.ParamID = t2.Param1ID
inner join t4 t4_2 on t4_2.ParamID = t3.Param2ID
" 
UpdateCommand="UPDATE t2 SET Param1ID = @newvalue WHERE (CompID = @CompID)">
        <UpdateParameters>
            <asp:Parameter Name="newvalue" />
            <asp:Parameter Name="CompID" />
        </UpdateParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource_Props" runat="server" ConnectionString="Data Source=.\SQLEXPRESS;Initial Catalog=test1;Integrated Security=True;Pooling=False"
        ProviderName="System.Data.SqlClient" SelectCommand="SELECT [PropName], [PropID] FROM [t4]">
    </asp:SqlDataSource>


в чем может быть проблема ?
или как этоотлаживать ? как посмотреть как update выглядит перед выполнением ?
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.