I need to write something in C# that allows users to query data in a human-readable format. So in a textarea, they would type in this:
Students.Class, name, address, classid, grade
Which would result in:
Marcus, 11B Westbury Ave. 200718, A+
What the above should do is: Look in the students DB, joining on the class table, then retrieving the name, address, classid, grade.
I have tried writing my own parsing method, splitting the string into an array and then based on the data in the array, querying the database. However, the issue that I am now having is that some users are making mistakes with the syntax:
Students, name, address, classid, grade
(Missing out the .class bit). So I have to throw try/catch methods and present the User with error messages.
The simple method above works, but I am wondering if there are any libraries out there that will take my string data and do what I am after?
MySQL LOWER() Function The LOWER() function converts a string to lower-case. Note: The LCASE() function is equal to the LOWER() function.
The INSTR() function returns the position of the first occurrence of a string in another string.
you want create parse at this way you need to learn flex and bison but there is a links can help you to create that.
https://www.codeproject.com/Articles/220042/Easily-Create-Your-Own-Parser https://www.codeproject.com/Articles/664785/A-New-Parser-Generator-for-Csharp
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