Click here to Skip to main content
15,901,284 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
<div class="  leftbiltyform  ">
           <asp:Label ID="lblconsignorid" runat="server" Text="Id:" Width="40%"></asp:Label>
            <asp:TextBox ID="txtCnsgnrID" runat="server" Width="30%" ></asp:TextBox><br />
           <asp:Label ID="lblconsignorfname" runat="server" Text="First Name:" Width="40%"></asp:Label>
           <asp:TextBox ID="txtCnsgnrFname" runat="server" CssClass="textbox" ></asp:TextBox>
           <br />
           <asp:Label ID="lblConsignorLname" runat="server" Text="Last Name:" Width="40%"></asp:Label>
           <asp:TextBox ID="txtCnsgnrLname" runat="server" CssClass="textbox"></asp:TextBox>
            <br />
             <asp:Label ID="lblConsignorcomname" runat="server" Text="Company Name:" Width="40%"></asp:Label>
             <asp:TextBox ID="txtCnsgnComName" runat="server" CssClass="textbox" ></asp:TextBox>
       <br />
             <asp:Label ID="lblCnsgnrAddress" runat="server" Text="Address:" Width="40%"></asp:Label>
             <asp:TextBox ID="txtCnsgnrAddress" runat="server" CssClass="textbox"></asp:TextBox>
           <asp:Label ID="lblCnsgnrLNo" runat="server" Text="Landline Number" Width="40%"></asp:Label>
           <asp:TextBox ID="txtCnsgnrLNo" runat="server" CssClass="textbox"  ></asp:TextBox><br />
             <asp:Label ID="lblPhNo" runat="server" Text="Phone Number" Width="40%"></asp:Label>
             <asp:TextBox ID="txtCnsgnrPhNo" runat="server" CssClass="textbox"
                ></asp:TextBox><br />
           <asp:Label ID="lblemail" runat="server" Text="Email:" Width="40%"></asp:Label>
           <asp:TextBox ID="txtconrEmail" runat="server" CssClass="textbox"></asp:TextBox><br />
            <div>
                <asp:Button ID="btnSave" runat="server" Text="Save" onclick="btnSave_Click" />
                <asp:Button ID="btnEdit" runat="server" Text="Edit" />
                <asp:Button ID="btnDelete" runat="server" Text="Delete" />
            </div>
         </div>
Posted
Comments
Tarun Mangukiya 24-Jun-11 2:54am    
Please give a description about it.
Member 7979544 24-Jun-11 3:03am    
I make Id autoincrimented ,now when i entered value in other text boxes and click save button that id also want incremented

C#
private void SaveConsigner()
  {
     // int id = 0;
      try
      {
          //objBll.BltId = objGenID.gmGetMstID("BLT", txtCNo.Text);
          //objBll.Consignorid = txtCnsgnrID.Text;
          //get last consigner id from database
          //DAL dalObj = new DAL();
          //id = Int32.Parse(dalObj.getLastId("Consignor")) + 1;
          //objBll.Consignorid = "CNSGNR"+(id.ToString());
          //txtCnsgnrID.Text = objBll.Consignorid;
          //MessageBox.Show(objBll.Consignorid);
          //return;
          objBll.Consignorid = objGenID.gmGetMstID("CNSNR", txtCnsgnrID.Text);
          txtCnsgnrID.Text = objBll.Consignorid;
          objBll.ConsignorFname = txtCnsgnrFname.Text;
          objBll.ConsignorLname = txtCnsgnrLname.Text;
          objBll.ConsignorComanyName = txtCnsgnComName.Text;
          objBll.ConsignorAddress = txtCnsgnrAddress.Text;
          objBll.ConsignorLandlineNo = txtCnsgnrLNo.Text;
          objBll.ConsignorPNo = txtCnsgnrPhNo.Text;
          objBll.ConsignorEmail = txtconrEmail.Text;

          objBll.Save("Consignor", "spInsertConsignor");
          Response.Write("<script>alert('Data Save Successfully')</script>");

          clearMasterInputText();

      }
 
Share this answer
 
You can use either
SQL
SELECT SCOPE_IDENTITY()
or
SQL
SELECT IDENT_CURRENT(‘tablename’)
based on your needs.

Scope identity gives you the last IDENTITY value generated by a connection and a statement in the same scope.

ident_current function returns the last IDENTITY value produced in a table.
 
Share this answer
 
what i want to code on save click button,so that id text box will generate auto incremented id.Please help
 
Share this answer
 
Comments
Christian Graus 24-Jun-11 4:11am    
You've been helped. Don't push 'answer' to comment. Don't comment just to beg for people to do your work for you, b/c you can't understand clear answers. If this is beyond you, then you can't do it, we can't help that.

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