Dim db As New DataClassesDataContext
Dim item As New wait_q
Dim newid As String
Dim lastid = From c In db.wait_q Order By c.q_id Descending Select c Take (1)
If lastid.Count > 0 Then
newid = lastid.First.q_id.Substring(2)
TextBox1.Text = "Q" & Format((Int32.Parse(newid) + 1), "00000")
Else
TextBox1.Text = "Q_00001"
End If
ผมเขียนด้วย vb นะคับ
Tag : .NET, Ms SQL Server 2008, VS 2008 (.NET 3.x)