© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•16mo ago•
7 replies
Dennis

Cant query the data with specified uid

I got a problem, I am using aps.net 6.0 with ef and dbcontext, I tried to query the uid with 16 char string, however, its not working:
I set dbcontext and its working and connected, its
string queryuid(uid)
{
Dbconnection dbcon = dbContext.dbconnection.firstOrDefault(e=>e.Uid == uid);


which dbcon always return null, however there are 3 records in database with uid I wanna find,
the uid is 16 char string and when I change as:
int count = dbContext.dbconnection.Count(e=>e.Uid == uid);
its return the int of 2, which is correct, I even tried:
dbContext.dbconnection.Where(e=>e.Uid == uid).first();
dbContext.dbconnection.Where(e=>e.Uid == uid).firstOrDefualt();
It's alwasy return null.
Can I know whats wrong?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ cant connect the data
C#CC# / help
2y ago
❔ Does indexof search for the specified character at the specified index?
C#CC# / help
3y ago
SignalR stream data to a specified client? [Answered]
C#CC# / help
4y ago