We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Increment Field Value

Thread ID:

Created:

Platform:

Replies:

36437 Oct 30,2005 07:58 AM UTC ASP.NET Web Forms (Classic) 0
loading
Tags: FAQ
lis
Asked On October 30, 2005 07:58 AM UTC

Hi All, I have 2 tables, TradeIn and ParaTable Both the tables have Fields ---TradeInNo and DivCd IF the TradeIn No is 100 the first time for a particular DivCd, on successive attempts it should be incremented. i.e., 101, 102, 103...etc DivCd is used to identify the various divisions namely, A, B, C, D according to which the TradeInNo is classified. That is for Division A tradeIn NO starts at 1000, B - 2000 etc. The below code gets me the first TradeInNo directly as available in Paratable: Code: ---------- Private Sub btnCreate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCreate.Click txtDate.Text = Date.Today Dim con As String = Application("conn") Dim SqlCon As New SqlConnection(con) Dim str As String str = ("Select TradeInNo from ParaTable where DivCd=''" & Application("DiviID") & "''") Dim cmd As SqlCommand = New SqlCommand(str, SqlCon) SqlCon.Open() Dim dr As SqlDataReader dr = cmd.ExecuteReader() While dr.Read txtTradeInNo.Text = dr.Item("TradeInNo").ToString End While SqlCon.Close() End Sub ----------------------------------------------- I want it that the last Trade In No from TradeInNo Table be checked and then this value should be incremented to give the new value for the corresponding division. Kindly help me to sort this out. Thanks and Regards, lis Db is in Sql

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;