Last post Jan 24, 2019 10:41 PM by Translating-it
Jan 22, 2019 05:13 PM|Translating-it|LINK
I'm working on my first Desktop Application and am using the old winform (no need to discuss about WPF or winform in this thread).
I set up a connection to an SQLite table and am able to retrieve data from it to display it in Gridview. Now I would like to add Regex to the query and I read that for this I would need to write a function to get Regex working in SQLite queries. I found
many threads about C# and other languages or web apps/websites, but how do I do this in a VB.NET Desktop App?
What do I need to write into that function? We are talking about VB.NET here, not C#, so please bear this in mind when answering.
Are there any relevant references for VB.NET on the web that I missed?
Jan 22, 2019 05:46 PM|PatriceSc|LINK
My understanding is that you are trying to use the regex feature in SQLite queries and it seems you have packages to add support for that rather than writing your own. Or you are looking at writing your own maybe based on .NET regular expressions ? It seems
it would be
https://www.ivankristianto.com/howto-make-user-defined-function-in-sqlite-ado-net-with-csharp/ (C# but the same principle applies as well to VB).
This forum is for web based application. If you need further help you should likely try
https://social.msdn.microsoft.com/Forums/en-US/home or maybe a SQLite specialized forum.
Jan 23, 2019 06:09 AM|Wei Zhang|LINK
According to your description, If you want to use regex in SQLite table in VB.NET, you could follow the steps in the website as blew:
Else when you face the problem using code in VB.net but not C# ,I suggest you could convert the c# to VB.net in this website.
Jan 24, 2019 10:41 PM|Translating-it|LINK
The first link lead to this one:
https://stackoverflow.com/questions/24229785/sqlite-net-sqlitefunction-not-working-in-linq-to-sql/26155359#26155359 where I found the function to convert to vb.net
<SQLiteFunction(Name:="REGEXP", Arguments:=2, FuncType:=FunctionType.Scalar)>
Public Class RegExSQLiteFunction
Public Overrides Function Invoke(ByVal args As Object()) As Object
Return System.Text.RegularExpressions.Regex.IsMatch(Convert.ToString(args(1)), Convert.ToString(args(0)))
The second link was not of great help.
Will check the other forum for desktop app question in future. I did not realize this one was only for web applications. ;)