how to increment value from database

Joined
Sep 18, 2007
Messages
3
Reaction score
0
Private Sub categorydroplist_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles categorydroplist.SelectedIndexChanged



Eiatxt.Text = (categorydroplist.SelectedValue + idnum + 0.1).ToString



End Sub



Private Sub Submittxt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Submittxt.Click



Dim InsertSQL As String

InsertSQL = "INSERT INTO [data1]("

InsertSQL &= "CategoryType,RefId,PreparedBy)"

InsertSQL &= " VALUES ('"

InsertSQL &= categorydroplist.SelectedValue & "','"

InsertSQL &= Eiatxt.Text & "','"

InsertSQL &= preparedbytxt.Text & "')"







Dim con As New SqlConnection(SqlConn)

Dim cmd As New SqlCommand(InsertSQL, con)

con.Open()

cmd.ExecuteNonQuery()

con.Close()



ClearControl()

BindCategory()



End Sub



for the above code:

when user choose the a value from dropdownlist

in the Eiatxt(text box) able to display the value which i want



like this if user click service type the value will be (1.1) if click the storage willl be (2.1)

so once is generate i able to fill the prepared column and save the data.

so i able to save the data into database...



at here i face another problem.

when the second user choose the service type my system must read the RefId from database.

if the value at database for RefId is 1.1

then it suppose to increment to 1.2...

how to do this....i got idea but don't knw how to implement into coding



PLEASE HELP ME SIR
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,266
Messages
2,571,075
Members
48,772
Latest member
Backspace Studios

Latest Threads

Top