C# windows form :-> Database : Access
I have made a query somewhat like this
Select * from Emp where E_Name Like 'Alok*??????'
the above query is for getting records that have Alok and 6 charachter in their name.
If I execute this query in access it works fine and fetches the record but when I try it in c#
Select * from Emp where E_Name Like 'Alok*??????'
Or
Select * from Emp where E_Name Like 'Alok%??????'
Both of them does not work and i have also tried both type of connection string
Microsoft.ACE.OLEDB.12.0;
And
Microsoft.Jet.OLEDB.4.0;
How to solve this problem?
You have this query which works in an Access session ...
Select * from Emp where E_Name Like 'Alok*??????'
When you want a similar query which you run from outside Access using OleDb, change the wild card characters ...
Select * from Emp where E_Name Like 'Alok%______'
But if you actually want only Alok followed by exactly 6 characters, use this instead ...
Select * from Emp where E_Name Like 'Alok______'
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