0

Hello!
I have problem! So, first of all I have page wich consist of 3 pages. In first page I press Button "Start" it will create empty record in my DB, in Page 2 is Form where I need to fill data and when I press Button "Next" it will update previos created record in DB, and in Page 3 it will update records created in DB.
Sorry for my language :)

For example Page 2 code

<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:TESTConnectionString %>" 
        DeleteCommand="DELETE FROM [Interview] WHERE [i_id] = @i_id" 
        InsertCommand="INSERT INTO [Interview] ([i_vacancy], [i_city], [i_status], [i_name], [i_surname], [i_persidentity], [i_phone], [i_mail], [i_citizen], [i_age], [i_crimeperiod], [i_crimereason], [i_g4speriod], [i_g4svacancy], [i_famg4speriod], [i_famg4svacancy], [i_education], [i_schoolname], [i_schoolfinished], [i_certificatenumber], [i_certificatefinish], [i_gunlicensedate], [i_gunlicensenumber], [i_gunkeep], [i_guncarry], [i_gunpersonal], [i_drivinglicense], [i_drivingauto], [i_personalauto], [i_pcskill], [i_internet], [i_internetuse], [i_lvlanguage], [i_medicine], [i_firesafe], [i_worksafe], [i_elektrosafe], [i_test]) VALUES (@i_vacancy, @i_city, @i_status, @i_name, @i_surname, @i_persidentity, @i_phone, @i_mail, @i_citizen, @i_age, @i_crimeperiod, @i_crimereason, @i_g4speriod, @i_g4svacancy, @i_famg4speriod, @i_famg4svacancy, @i_education, @i_schoolname, @i_schoolfinished, @i_certificatenumber, @i_certificatefinish, @i_gunlicensedate, @i_gunlicensenumber, @i_gunkeep, @i_guncarry, @i_gunpersonal, @i_drivinglicense, @i_drivingauto, @i_personalauto, @i_pcskill, @i_internet, @i_internetuse, @i_lvlanguage, @i_medicine, @i_firesafe, @i_worksafe, @i_elektrosafe, @i_test) SET @i_id = SCOPE_IDENTITY();" 
       
 SelectCommand="SELECT * FROM [Interview] WHERE (i_id = SCOPE_IDENTITY())" 
       
 UpdateCommand="UPDATE [Interview] SET [i_vacancy] = @i_vacancy, [i_city] = @i_city, [i_status] = @i_status, [i_name] = @i_name, [i_surname] = @i_surname, [i_persidentity] = @i_persidentity, [i_phone] = @i_phone, [i_mail] = @i_mail, [i_citizen] = @i_citizen, [i_age] = @i_age, [i_crimeperiod] = @i_crimeperiod, [i_crimereason] = @i_crimereason, [i_g4speriod] = @i_g4speriod, [i_g4svacancy] = @i_g4svacancy, [i_famg4speriod] = @i_famg4speriod, [i_famg4svacancy] = @i_famg4svacancy, [i_education] = @i_education, [i_schoolname] = @i_schoolname, [i_schoolfinished] = @i_schoolfinished, [i_certificatenumber] = @i_certificatenumber, [i_certificatefinish] = @i_certificatefinish, [i_gunlicensedate] = @i_gunlicensedate, [i_gunlicensenumber] = @i_gunlicensenumber, [i_gunkeep] = @i_gunkeep, [i_guncarry] = @i_guncarry, [i_gunpersonal] = @i_gunpersonal, [i_drivinglicense] = @i_drivinglicense, [i_drivingauto] = @i_drivingauto, [i_personalauto] = @i_personalauto, [i_pcskill] = @i_pcskill, [i_internet] = @i_internet, [i_internetuse] = @i_internetuse, [i_lvlanguage] = @i_lvlanguage, [i_medicine] = @i_medicine, [i_firesafe] = @i_firesafe, [i_worksafe] = @i_worksafe, [i_elektrosafe] = @i_elektrosafe WHERE [i_id] = @i_id">
        
        <DeleteParameters>
            <asp:Parameter Name="i_id" Type="Int32" />
        </DeleteParameters>
    
    <UpdateParameters>
            <asp:Parameter Name="i_vacancy" Type="String" />
            <asp:Parameter Name="i_city" Type="String" />
            <asp:Parameter Name="i_status" Type="String" />
            <asp:Parameter Name="i_name" Type="String" />
            <asp:Parameter Name="i_surname" Type="String" />
            <asp:Parameter Name="i_persidentity" Type="String" />
            <asp:Parameter Name="i_phone" Type="String" />
            <asp:Parameter Name="i_mail" Type="String" />
            <asp:Parameter Name="i_citizen" Type="String" />
            <asp:Parameter Name="i_age" Type="Decimal" />
            <asp:Parameter DbType="Date" Name="i_crimeperiod" />
            <asp:Parameter Name="i_crimereason" Type="String" />
            <asp:Parameter Name="i_g4speriod" Type="String" />
            <asp:Parameter Name="i_g4svacancy" Type="String" />
            <asp:Parameter Name="i_famg4speriod" Type="String" />
            <asp:Parameter Name="i_famg4svacancy" Type="String" />
            <asp:Parameter Name="i_education" Type="String" />
            <asp:Parameter Name="i_schoolname" Type="String" />
            <asp:Parameter DbType="Date" Name="i_schoolfinished" />
            <asp:Parameter Name="i_certificatenumber" Type="String" />
            <asp:Parameter DbType="Date" Name="i_certificatefinish" />
            <asp:Parameter DbType="Date" Name="i_gunlicensedate" />
            <asp:Parameter Name="i_gunlicensenumber" Type="String" />
            <asp:Parameter Name="i_gunkeep" Type="String" />
            <asp:Parameter Name="i_guncarry" Type="String" />
            <asp:Parameter Name="i_gunpersonal" Type="String" />
            <asp:Parameter Name="i_drivinglicense" Type="String" />
            <asp:Parameter Name="i_drivingauto" Type="String" />
            <asp:Parameter Name="i_personalauto" Type="String" />
            <asp:Parameter Name="i_pcskill" Type="String" />
            <asp:Parameter Name="i_internet" Type="Boolean" />
            <asp:Parameter Name="i_internetuse" Type="String" />
            <asp:Parameter Name="i_lvlanguage" Type="Boolean" />
            <asp:Parameter Name="i_medicine" Type="Boolean" />
            <asp:Parameter Name="i_firesafe" Type="Boolean" />
            <asp:Parameter Name="i_worksafe" Type="Boolean" />
            <asp:Parameter Name="i_elektrosafe" Type="Boolean" />
            <asp:Parameter Name="i_id" Type="Int32" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="i_vacancy" Type="String" />
            <asp:Parameter Name="i_city" Type="String" />
            <asp:Parameter Name="i_status" Type="String" />
            <asp:Parameter Name="i_name" Type="String" />
            <asp:Parameter Name="i_surname" Type="String" />
            <asp:Parameter Name="i_persidentity" Type="String" />
            <asp:Parameter Name="i_phone" Type="String" />
            <asp:Parameter Name="i_mail" Type="String" />
            <asp:Parameter Name="i_citizen" Type="String" />
            <asp:Parameter Name="i_age" Type="Decimal" />
            <asp:Parameter DbType="DateTime" Name="i_crimeperiod" />
            <asp:Parameter Name="i_crimereason" Type="String" />
            <asp:Parameter Name="i_g4speriod" Type="String" />
            <asp:Parameter Name="i_g4svacancy" Type="String" />
            <asp:Parameter Name="i_famg4speriod" Type="String" />
            <asp:Parameter Name="i_famg4svacancy" Type="String" />
            <asp:Parameter Name="i_education" Type="String" />
            <asp:Parameter Name="i_schoolname" Type="String" />
            <asp:Parameter DbType="DateTime" Name="i_schoolfinished" />
            <asp:Parameter Name="i_certificatenumber" Type="String" />
            <asp:Parameter DbType="DateTime" Name="i_certificatefinish" />
            <asp:Parameter DbType="DateTime" Name="i_gunlicensedate" />
            <asp:Parameter Name="i_gunlicensenumber" Type="String" />
            <asp:Parameter Name="i_gunkeep" Type="String" />
            <asp:Parameter Name="i_guncarry" Type="String" />
            <asp:Parameter Name="i_gunpersonal" Type="String" />
            <asp:Parameter Name="i_drivinglicense" Type="String" />
            <asp:Parameter Name="i_drivingauto" Type="String" />
            <asp:Parameter Name="i_personalauto" Type="String" />
            <asp:Parameter Name="i_pcskill" Type="String" />
            <asp:Parameter Name="i_internet" Type="Boolean" />
            <asp:Parameter Name="i_internetuse" Type="String" />
            <asp:Parameter Name="i_lvlanguage" Type="Boolean" />
            <asp:Parameter Name="i_medicine" Type="Boolean" />
            <asp:Parameter Name="i_firesafe" Type="Boolean" />
            <asp:Parameter Name="i_worksafe" Type="Boolean" />
            <asp:Parameter Name="i_elektrosafe" Type="Boolean" />
            <asp:Parameter Name="i_test" Type="String" />
            <asp:Parameter Name="i_id" Type="Int32" />
        </InsertParameters>
    </asp:SqlDataSource>

Code Behind

protected void buttonNext_Click(object sender, EventArgs e)
  {
       if (Page.IsValid)
       {
            labelResponse.Text = "Thanks!";
            SqlDataSource1.InsertParameters["i_vacancy"].DefaultValue = TextOther.Text.ToString();
            SqlDataSource1.InsertParameters["i_city"].DefaultValue = TextOther2.Text.ToString();
            SqlDataSource1.InsertParameters["i_status"].DefaultValue = TextOther3.Text.ToString();
            SqlDataSource1.Insert();
            Response.Redirect("Page3.aspx");
        }
        else
        {
            labelResponse.Text = "Fill data.";
        }

    }
2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by MichaelWClark
0

okay...I dont understand the question first off. Secondly. Read about LINQ to SQL..its amazing, I used to do the same thing you are here...never again! Third. Insert does just that INSERTS a row of data (already populated). If you INSERT a blank row you will then need to UPDATE it to change the info in it...so blank row inserts are...no good.


Rephrase the question so we can answer it more directly.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.