Last post Jun 14, 2018 09:49 AM by DA924
Jun 14, 2018 07:56 AM|shsu|LINK
I am using vb.net(vs 2017) and sql 2017
Incident table is having Incidentnumber as primary key and datatype Bigint with auto increment 1.So the first number will be 1...then 2..
Actually in vb.net program I want this Incidentnumber to concatenated with SING .The first number must be 0001 then 0002....2000,2001 like that .Format will be
So In vb.net my code is as follows
cmd = New SqlCommand
cmd.Connection = con
cmd.CommandText = "Insert into IncidentMaster(Name) values ('" + Name.Text + "')"
cmd.CommandText = "SELECT TOP(1) Incidentnumber FROM IncidentMaster ORDER BY 1 DESC"
drd = cmd.ExecuteReader
If drd.HasRows = True Then
incidentnumber.Text = drd.Item("Incidentnumber")
Catch ex As Exception
I am confused at below code .I want to add 'SING' infront of the incidentnumber.Text value.value of incident number in sql databse will be 1. But I want the answer to be SING0001 and now it coming SING1.
newnumber.Text = "SING" & incidentnumber.Text
Thanks in advance
Jun 14, 2018 09:49 AM|DA924|LINK
newnumber.Text = "SING" & incidentnumber.ToString()