Database update problems

1 posts, 0 answers
  1. Hassen
    Hassen avatar
    4 posts
    Member since:
    Aug 2010

    Posted 31 Aug 2010 Link to this post

    i have database update problems with two related listboxes , the errors appear when i try to move an item from the first listbox to the second (it seems like the fields value is not transferred with the item) or when i try to delete an item from the second listbox (scalar variable isn't declared error)!
    Got a problem also with my ajaxpanel it dosent seem to work (the page reloads when i try to move an item)

    i would liked to attach my project but it says File is not of correct type so here is the aspxpage code !

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication3._Default" %>
    <%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <head runat="server">
        <form id="form1" runat="server">
        <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" height="200px"
            width="737px" HorizontalAlign="NotSet"
            LoadingPanelID="RadAjaxLoadingPanel1" RenderMode="Inline">
            <div style="float:left; margin-left:20px">
                runat="server" ID="RadListBox1"
                DataKeyField="mail" DataTextField="mail" DataSortField="mail" Height="200px"
                AllowTransfer="True" TransferToID="RadListBox2"
                AutoPostBackOnTransfer="True" DataValueField="mail"
                    style="top: 0px; left: 0px; width: 222px" AllowAutomaticUpdates="True"
                    TransferMode="Copy" />
        <div style="float:left; margin-left:20px;">
                runat="server" ID="RadListBox2"
                DataKeyField="mail" DataTextField="mail" DataSortField="SortOrder"
                Width="230px" Height="200px"
                AllowReorder="True" AutoPostBackOnReorder="True"
                AllowDelete="True" AutoPostBackOnDelete="True"
                AllowAutomaticUpdates="True" DataValueField="mail"
                TransferToID="RadListBox1" />
                <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" Runat="server"
        <asp:SqlDataSource ID="SqlDataSource1" runat="server"
            ConnectionString="<%$ ConnectionStrings:notifications_dbConnectionString %>"
            DeleteCommand="DELETE FROM [utilisateurs] WHERE [mail] = @mail"
            InsertCommand="INSERT INTO [utilisateurs] ([mail]) VALUES (@mail)"
            SelectCommand="SELECT [mail] FROM [utilisateurs]">
                <asp:Parameter Name="mail" Type="String" />
                <asp:Parameter Name="mail" Type="String" />
        <telerik:RadScriptManager ID="RadScriptManager1" Runat="server">
        <asp:SqlDataSource ID="SqlDataSource2" runat="server"
            ConnectionString="<%$ ConnectionStrings:notifications_dbConnectionString %>"
            DeleteCommand="DELETE FROM [presents] WHERE [mail] = @mail AND [id_plan] = @id_plan"
            InsertCommand="INSERT INTO [presents] ([mail], [id_plan]) VALUES (@mail, @id_plan)"
            SelectCommand="SELECT [mail], [id_plan] FROM [presents]">
                <asp:Parameter Name="mail" Type="String" />
                <asp:Parameter Name="id_plan" Type="Int32" />
                <asp:Parameter Name="mail" Type="String"/>
       <%--in my project the id_plan key is transferred with a link but you can do the same by adding to the current page
       adresse in the browser " ?id_plan=key" key could be 2 or 1 here --%>        
                <asp:QueryStringParameter DefaultValue="2" Name="id_plan"
                    QueryStringField="id_plan" Type="Int32" />
Back to Top