รบกวนช่วยหน่อยค่ะ จะทำ หมายเลขใบเสร็จสินค้าค่ะ แต่มัน Error: input string was not in a correct format
Code (VB.NET)
Using ts As New TransactionScope()
Dim FirstID As String = ""
Dim SecondID As Integer = 0
Dim csids = From cid In db.CashSales _
Order By cid.SaleID Descending Take (1)
Dim LastSaleID As String = ""
If csids.Count() = 1 Then
FirstID = csids.SingleOrDefault().SaleID.Left(4)
SecondID = Integer.Parse(csids.SingleOrDefault().SaleID.Right(6)) 'Error บรรทัดนี้ค่ะ SecondID += 1
LastSaleID = String.Format(FirstID, "0000") & SecondID.ToString("000000")
Else
LastSaleID = BizConfig.CurrentBranchID & "000001"
End If
Tag : .NET, Ms SQL Server 2008, LINQ, VB.NET, VS 2008 (.NET 3.x)