Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am working in a project called ERP Systems.

I had a question about a SQL stored procedure.

Currently I designed a masters page for entering the product details... i.e. using ajax tab container I designed product id, product name in one tab and product name, purchase rate, selling price in another tab.

I created a table for the page and I create two stored procedures for inserting the values separately in the table i.e. in first tab product id and product name is used to insert in that table and in second tab using product name (dynamically added) I should insert purchase rate, selling price etc...

is it possible for do like this.

We can insert the two different values in two different times in one table.

I am using sql server 2005, .net 2.0.


I had only one table named tblmasters in sql & after inserting products, have to enter purchase rate, selling price,etc.. at two different times, using two insert query (stored procedures).. I am using ajax tab container so that the tab panel has two design forms....

I don't know whether it is possible... i am just asking you friends.

What I have tried:

<ajax:tabcontainer style="Z-INDEX:1" id="TC" runat="server" activetabindex="0" width="346px">
<br mode="hold" xmlns:ajax="#unknown" /><ajax:tabpanel runat="server" id="tp1">
<br mode="hold" xmlns:ajax="#unknown" />
<HeaderTemplate>ADD PRODUCTS</HeaderTemplate>
<ContentTemplate>
<table style="BORDER-RIGHT: darkgray solid; BORDER-TOP: darkgray solid; BORDER-LEFT: darkgray solid" class="Border" cellSpacing=4 cellPadding=4>
    <tr class="Heading" align="center" height="10%">
        <td colspan="3">PRODUCTS</td></tr>
    <tr>
        <td>
        <asp:Label id="lblpid" runat="server" CssClass="Labels" Text="Product ID"></asp:Label>
        </td>
        <td>:</td>
        <td><asp:TextBox id="txtpid" runat="server"></asp:TextBox> </td></tr>
    <tr>
        <td>
        <asp:Label id="lblproductname" runat="server" CssClass="Labels" Text="Product Name"></asp:Label>
        </td>
        <td>:</td>
        <td>
            <asp:TextBox id="txtpname" runat="server"></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td colspan="3" align="center"><asp:Label ID="lblmsg" runat="server" Font-Bold="True"></asp:Label></td>
        <td align="right">
            <asp:Button ID="addprobtn" runat="server" Text="Add" OnClick="addprobtn_Click" />
        </td>
    </tr>
    <tr align="center">
        <td colspan="3">
        <asp:Panel ID="pan1" runat="server">
            <asp:GridView ID="addpro_Grid2" runat="server" Width="276px" AutoGenerateColumns="False" AllowPaging="True" OnPageIndexChanging="addpro_Grid2_PageIndexChanging" PageSize="5">
                <SelectedRowStyle CssClass="GridSelectedItem" /><AlternatingRowStyle CssClass="GridAlter" />
                <EditRowStyle CssClass="GridEditItem" />
             <Columns>
                <asp:BoundField DataField="pid" HeaderText="Products ID" />
                <asp:BoundField DataField="pname" HeaderText="Products Name" />
             </Columns>
            </asp:GridView>
        </asp:Panel> </td></tr>
        <tr> <td colspan="3">
   <center>
        <asp:ImageButton id="apbtnadd" runat="server" ImageUrl="~/admin/Images/addbtnrose.png" Height="50px" OnClick="apbtnadd_Click1" Width="60px"></asp:ImageButton>
        <asp:ImageButton id="apbtnsave" runat="server" ImageUrl="~/admin/Images/savebtnrose.png" Height="50px" Width="60px" OnClick="apbtnsave_Click"></asp:ImageButton>
        <asp:ImageButton id="apbtnedit" runat="server" ImageUrl="~/admin/Images/editbtnrose.png" Height="50px" Width="60px"></asp:ImageButton>
        <asp:ImageButton id="apbtndelete" runat="server" ImageUrl="~/admin/Images/deletebtnrose.png" Height="50px" Width="60px"></asp:ImageButton>
   </center></td></tr>
   </table>
</ContentTemplate>
</Ajax:TabPanel>
<Ajax:TabPanel runat="server" ID="tp2">
    <HeaderTemplate>PRODUCTS RATE</HeaderTemplate>
    <ContentTemplate>
    <div align="center">
        <table style="BORDER-RIGHT: darkgray solid; BORDER-TOP: darkgray solid; BORDER-LEFT: darkgray solid" cellspacing="2" cellpadding="2" width=550>
          <tr>
            <td class="Heading" align=center>PRODUCTS RATE</td>
          </tr>
        </table>
        <table style="BORDER-RIGHT: darkgray solid; BORDER-LEFT: darkgray solid" class="Border" width="550" align="center" >
        <tr>
            <td>
            <asp:Label ID="lblprpid" runat="server" CssClass="Labels" Text="Product ID"></asp:Label>
            </td>
            <td>
            <asp:TextBox id="txtprpid" runat="server"></asp:TextBox>
            </td>
            <td align="left">
            <asp:Label id="lbldate" runat="server" CssClass="Labels" Text="Date"></asp:Label>
            </td>
            <td>
            <asp:TextBox id="txtdate" runat="server"></asp:TextBox>
            <Ajax:CalendarExtender id="cedate" runat="server" Enabled="True" TargetControlID="txtdate"></Ajax:CalendarExtender>
            </td>
       </tr>
       <tr>
            <td align="left">
            <asp:Label id="lblpname" runat="server" CssClass="Labels" Text="Product Name"></asp:Label>
            </td>
            <td>
                <asp:DropDownList id="ddlname" runat="server" Width="155px">
                    <asp:ListItem>--Select--</asp:ListItem>
                </asp:DropDownList>
            </td>
            <td align="left">
                <asp:Label id="lblrate" runat="server" CssClass="Labels" Text="Purchase Rate"></asp:Label>
            </td>
            <td>
                <asp:TextBox id="txtrate" runat="server"></asp:TextBox>
            </td>
            </tr>
            <tr>
                <td align="left">
                    <asp:Label id="lblqty" runat="server" CssClass="Labels" Text="Quantity"></asp:Label>
                </td>
                <td>
                    <asp:TextBox id="txtqty" runat="server"></asp:TextBox>
                </td>
                <td align="left">
                    <asp:Label id="lbltamt" runat="server" CssClass="Labels" Text="Total Amount"></asp:Label>
                </td>
                <td>
                    <asp:TextBox id="txttamt" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td align="left">
                    <asp:Label id="lblspamt" runat="server" CssClass="Labels" Text="Selling Price/Unit"></asp:Label>
                </td>
                <td>
                    <asp:TextBox id="txtspamt" runat="server"></asp:TextBox>
                </td>
                <td align="left">
                    <asp:Label id="lblstock" runat="server" CssClass="Labels" Text="Stock In Hand"></asp:Label>
                </td>
                <td>
                    <asp:TextBox id="txtstock" runat="server" ReadOnly="True"></asp:TextBox>
                </td>
             </tr>
             <tr align="right">
                <td colspan="4">
                    <asp:Button ID="praddbtn" runat="server" Text="Add" OnClick="praddbtn_Click1" />
                </td>
             </tr>
         </table>
         </div>
         <table style="BORDER-RIGHT: darkgray solid; BORDER-LEFT: darkgray solid; BORDER-BOTTOM: darkgray solid" class="Border" width="550" align="center">
            <tr align="center">
                <td colspan="4">
                    <asp:GridView ID="pr_Grid" runat="server" AutoGenerateColumns="False">
                        <SelectedRowStyle CssClass="GridSelectedItem" /><AlternatingRowStyle CssClass="GridAlter" />
                        <EditRowStyle CssClass="GridEditItem" />
                     <Columns>
                        <asp:BoundField DataField="pname" HeaderText="Product Name" />
                        <asp:BoundField DataField="prate" HeaderText="Purchase Rate" />
                        <asp:BoundField DataField="qty" HeaderText="Quantity" />
                        <asp:BoundField DataField="tamt" HeaderText="Total Amount" />
                        <asp:BoundField DataField="spamt" HeaderText="Selling Price" />
                     </Columns>
                    </asp:GridView>
                </td>
            </tr>
            <tr align="center">
                <td colspan="4">
                <center>
                <asp:ImageButton id="prbtnadd" runat="server" ImageUrl="~/admin/Images/addbtnrose.png" Height="50px"  önClick="prbtnadd_Click"></asp:ImageButton>
                <asp:ImageButton id="prbtnsave" runat="server" ImageUrl="~/admin/Images/savebtnrose.png" Height="50px"></asp:ImageButton>
                <asp:ImageButton id="prbtnedit" runat="server" ImageUrl="~/admin/Images/editbtnrose.png" Height="50px"></asp:ImageButton>
                <asp:ImageButton id="prbtndelete" runat="server" ImageUrl="~/admin/Images/deletebtnrose.png" Height="50px"></asp:ImageButton>
                </center>
               </td>
            </tr>
</ContentTemplate>
</Ajax:TabPanel>
</Ajax:TabContainer>
Posted
Updated 22-Dec-16 8:18am
v3
Comments
[no name] 4-Jul-11 7:30am    
please explain more what you want. its jumble. is it that you want to enter master record in one table for the product.
[no name] 4-Jul-11 7:31am    
Do you have other table that reference product table for inserting purchase rate and saling rate??

You would benefit greatly from doing a little learning about databases, normalization of data, and stored procedures, etc.

An application is only as efficient as the data structure used. For example, if the data structure is not normalized properly then retrieving data will become problematic and buggy. That will cause the entire application to perform badly. On the other side of the coin, with a really good data structure, even a really crappy UI can hum along reasonably well. (Obviously I'm not promoting bad front end code because that would just be silly. Write both sides well.)
 
Share this answer
 
You can go ahead and insert data in the same table in the same procedure with different insert commands.
 
Share this answer
 
Normalization can be a solution...
 
Share this answer
 
You will have to pass two separate insert command to do so..
 
Share this answer
 
Hi,
In stored procedure you can have multiple queries, no issue with that.
But I think you need to normalize your table but still you can enter values the way you mentioned without any error.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900