Catch Error Linq query to check datatable

Hello all,

my Linq command, which I am using thanks to your support, is causing the following error, how can I fix this?

(From d In DT_aus_PDF.AsEnumerable
Where System.Text.RegularExpressions.Regex.IsMatch(d(“Column2”).ToString,“([0-9]{8})”)
Where Not d(“Column3”).ToString=“”
Select d).CopyToDataTable().DefaultView.ToTable(False, “Column1”,“Column2”,“Column3”,“Column4”,“Column5”,“Column6”,“Column7”)

Error Message “PDF in Excel umwandeln: The source contains no DataRows.”

Hi @NHoe

This will be helpful for you

Also, you can try this

If(		
		(
			From d In DT_aus_PDF.AsEnumerable()
			Let c1 =  System.Text.RegularExpressions.Regex.IsMatch(d("Column2").ToString,"([0-9]{8})")
			Let c2 =  Not String.IsNullOrEmpty(d("Column3").ToString)
			Where c1 And c2
			Select d
		).Count.Equals(0),	
		_
		Nothing,
		_
		(
			From d In DT_aus_PDF.AsEnumerable()
			Let c1 =  System.Text.RegularExpressions.Regex.IsMatch(d("Column2").ToString,"([0-9]{8})")
			Let c2 = Not String.IsNullOrEmpty(d("Column3").ToString)
			Where c1 And c2
			Select d
		).CopyToDataTable().DefaultView.ToTable(False, {"Column1","Column2","Column3","Column4","Column5","Column6","Column7"})
)

it works, thank you!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.