Skip to content

Instantly share code, notes, and snippets.

@cincauhangus
Created December 28, 2016 06:13
Show Gist options
  • Select an option

  • Save cincauhangus/2df9753da1706d14f9113b822eea8883 to your computer and use it in GitHub Desktop.

Select an option

Save cincauhangus/2df9753da1706d14f9113b822eea8883 to your computer and use it in GitHub Desktop.
Linq to SQL Conversions
Dim value = "F!NDM3"
' strColumn LIKE '%F!NDM3%'
Dim results1 = (From row In table Where row.strColumn.Contains(value) Select id)
' strColumn LIKE 'F!NDM3%'
Dim results2 = (From row In table Where row.strColumn.StartsWith(value) Select id)
' strColumn LIKE '%F!NDM3'
Dim results3 = (From row In table Where row.strColumn.EndsWith(value) Select id)
' strColumn LIKE 'F!NDM3'
Dim results4 = (From row In table Where System.Data.Linq.SqlClient.SqlMethods.Like(row.strColumn, value) Select id)
' strColumn = 'F!NDM3'
Dim results5 = (From row In table Where String.equals(row.strColumn, value) Select id)
' strColumn = 'F!NDM3'
Dim results6 = (From row In table Where row.strColumn.equals(value) Select id)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment