[Solved] C# SQLite getting an SQL logic error when trying to SELECT * FROM [duplicate]

Use a parameterized query SqlCommand Parameters var sql = new SqlCommand( “SELECT * FROM Customers WHERE name like @Name”, m_dbConnection ); var param = new SqlParameter(); param.ParameterName = “@Name”; param.Value = textBox1.Text; cmd.Parameters.Add(param); solved C# SQLite getting an SQL logic error when trying to SELECT * FROM [duplicate]

[Solved] How can i create dynamically allocated array In C [duplicate]

Assuming you have the number of rows “r” and the number of columns “c”, you can do this: int **arr; arr = malloc(r*sizeof(int*)); for(int i=0; i < r; i++) { arr[i] = malloc(c*sizeof(int)); } this dynamically allocates an array of pointers to integers, and then allocates arrays of integers to each pointer. Don’t forget to … Read more

[Solved] when to use await key word? do I need it in this case?

no you don’t need to do that, you can use .Result if you don’t want to execute your code asynchronously , this code is perfectly fine : private void Button_Clicked(object sender, EventArgs e) { try { var getTokenQ = SecureStorage.GetAsync(“Save_Security_Question”).Result; if ((String.IsNullOrWhiteSpace(getTokenQ) == false)) { } else { } } catch (Exception ex) { DisplayAlert(“Message”, … Read more

[Solved] VS function that must start with a letter, but accept numbers after the letter

I end up adding the first letters to my code, and enforcing with must add 3 letters to the beginning of the number scanned {3} and with that , it worked. if (!System.Text.RegularExpressions.Regex.IsMatch(txtLotNumber.Text, “^[A-Z]{3}[0-9-]”)) { MessageBox.Show(“Please scan Supplier Lot barcode at Supply Lot field”); return; } solved VS function that must start with a letter, … Read more

[Solved] I need to subtract value from the array [closed]

Your best bet is a for loop. This will allow you to perform an action (I.E subtraction) on each ‘element’ of an array. By using a return statement, you can return the new array that has had each element modified EDIT As per @AlexeiLevenkov’s comment, I have updated my answer to keep a count of … Read more

[Solved] How to round two decimals [closed]

You have your string: string str = “4.29 x 4.30 x 2.58mm”; Maybe remove the mm str = str.Replace(“mm”, “”); Split them: string[] nums = str.Split(new[] { ” x ” }, StringSplitOptions.None); Round them: Math.Round(Double, Int32) Rounds a double-precision floating-point value to a specified number of fractional digits, and rounds midpoint values to the nearest … Read more

[Solved] Can anyone explain what is the default interface implementation in C# 8.0? [closed]

Default implementations is a feature in C# 8.0 that an interface member can now be specified with a code body, and if an implementing class or struct does not provide an implementation of that member, no error occurs. Instead, the default implementation is used. Read more here: Default Interface Implementation solved Can anyone explain what … Read more

[Solved] Extract special characters from a text in C#

Try following : using System.Linq; using System.Text; using System.IO; using System.Text.RegularExpressions; namespace ConsoleApplication1 { class Program { const string FILENAME = @”c:\temp\test.txt”; static void Main(string[] args) { string input = File.ReadAllText(FILENAME); StringReader reader = new StringReader(input); string line = “”; string pattern = @”time=(?’time’\d+)”; while((line = reader.ReadLine()) != null) { if (line.StartsWith(“Reply from”)) { Match … Read more

[Solved] Replace the same line if contains any word in it in c# [closed]

This is a fairly simple task: string url = @”http://google.com/adi/727412;sz=728×90;ord=$RANDOM?”; if (url.Contains(@”/adi/”)) { int pos = url.IndexOf(“;ord”); //// Find first occurence of Ord parameter url = url.Insert(pos, “;click=$CLICK”); //// Insert text at position } Edit: To accomplish the task for multiple occurences I used a solution from this thread. { string url = “<google.com/adi/727412;sz=728×90;ord=$RANDOM?>; <google.com/adi/727412;sz=300×250;ord=$RANDOM?>”; … Read more