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?
regards,
Pascal
Dear ASP.NET, stop setting my threads to answered only cos I had no time to check em. I'm not fulltime programmer n only get to programming every 2-3 weeks but I ALWAYS answer n close solved threads, but u DON'T know if a problem is solved for TS or not!
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).
<SQLiteFunction(Name:="REGEXP", Arguments:=2, FuncType:=FunctionType.Scalar)>
Public Class RegExSQLiteFunction
Inherits SQLiteFunction
Public Overrides Function Invoke(ByVal args As Object()) As Object
Return System.Text.RegularExpressions.Regex.IsMatch(Convert.ToString(args(1)), Convert.ToString(args(0)))
End Function
End Class
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. ;)
regards,
Pascal
Dear ASP.NET, stop setting my threads to answered only cos I had no time to check em. I'm not fulltime programmer n only get to programming every 2-3 weeks but I ALWAYS answer n close solved threads, but u DON'T know if a problem is solved for TS or not!
Member
52 Points
283 Posts
VB.NET winform Regex in SQLite
Jan 22, 2019 05:13 PM|Translating-it|LINK
Hi,
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?
regards,
Pascal
All-Star
43240 Points
14960 Posts
Re: VB.NET winform Regex in SQLite
Jan 22, 2019 05:46 PM|PatriceSc|LINK
Hi,
Try perhaps https://stackoverflow.com/questions/5071601/how-do-i-use-regex-in-a-sqlite-query
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.
Member
370 Points
181 Posts
Re: VB.NET winform Regex in SQLite
Jan 23, 2019 06:09 AM|Wei Zhang|LINK
Hi Translating-it,
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:
http://www.schemamania.org/sql/sqlite/udf/
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.
http://converter.telerik.com/
Best Regards
Wei Zhang
Member
52 Points
283 Posts
Re: VB.NET winform Regex in SQLite
Jan 24, 2019 10:41 PM|Translating-it|LINK
Hi Patrice,
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
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. ;)
regards,
Pascal