Skip to content

Tag: c#

C# Is it safe to concatenate constant strings to form a SQL Query?

I need to change the table name dynamically based on specific conditions. Is it safe to build my sql query the following way or am I prone to SQL Injection? To generalize, I want to build a parameterized sql query string by concatenating constant strings. Answer While this should not present any security prob…

Extracting hashtags by sql

I have this problem – currently I am extracting hashtags in a C# application but now I want to move it to SQL Server. In C# I have code using a regex: In T-SQL, I would like to have something like this: Answer Using the string_split

I didn’t true use order by in linq

Hi i develop web app with c#. I have sql query and i convert to linq but it’s not working true because of order by My sql query My linq Answer Here’s how you can do the order by on the count of each group and take the 3 with the highest count.

Remove “” from string or in SQL varchar

Is it even possible to return value of string without the ” ” ? I have the following string: Chb = “NOT”; Now i either want to remove the “” in C# or SQL. so i want to have either Chb = NOT in C# ,or i want to remove the ‘ ‘ in SQL that i get in @Chb