Quote:
I am getting data into checkinvoiceNo.But My syntax of append a string is not correct
I am getting like that checkinvoice no = NZ-SP/13-14/00002 ,NZ-SP/13-14/00001 ,
But I wanna get like that checkinvoice no = 'NZ-SP/13-14/00002' , 'NZ-SP/13-14/00001'
I would recommend that you use a StringBuilder to construct "CheckedInvoiceNo". Something like this:
Dim CheckedInvoiceNo As New System.Text.StringBuilder()
For Each CheckedItem As Object In chklistbx.CheckedItems
If CheckedInvoiceNo.Length > 0 Then
CheckedInvoiceNo.Append(","c)
End If
CheckedInvoiceNo.Append("'"c)
CheckedInvoiceNo.Append(CheckedItem.ToString())
CheckedInvoiceNo.Append("'"c)
Next
sql = "select PFDate,PFNo,CustType,Party,PartyCode,SaleNo,SaleDate,InvHeading,SaleType,Mode,Transporter from sale where PFNo IN (" & CheckedInvoiceNo.ToString() & ")"
Also, please pay heed to Pete Leow's comments about parameterized queries.