I've a Languages table:
LangId LangName
1 English
2 EngTest
3 Germany
I want to write a query that shows LangName begins 'Eng'
var query = dc.Languages.Where(p=>p.LangName.Contains(txtBxLangNameFilter.Text));
I'm newbie in linq to sql. Can somebody show me how to write?
Contains
test if a string is found in a string at any location. Since you want to test for a string that starts with a certain string, use StartsWith()
.
var query = dc.Languages
.Where(p => p.LangName.StartsWith(txtBxLangNameFilter.Text));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With