Click here to Skip to main content
15,895,142 members
Home / Discussions / C#
   

C#

 
GeneralRe: ToList() or not to List. Pin
harold aptroot17-Dec-23 6:15
harold aptroot17-Dec-23 6:15 
GeneralRe: ToList() or not to List. Pin
Pete O'Hanlon18-Dec-23 3:49
mvePete O'Hanlon18-Dec-23 3:49 
Questioncircular slider on winform Pin
sdecorme11-Dec-23 3:23
sdecorme11-Dec-23 3:23 
AnswerRe: circular slider on winform Pin
Ralf Meier11-Dec-23 3:42
mveRalf Meier11-Dec-23 3:42 
Questionwrite the C# windows form based program that allow user conversion of number system Pin
Kemal Tajudin10-Dec-23 8:13
Kemal Tajudin10-Dec-23 8:13 
AnswerRe: write the C# windows form based program that allow user conversion of number system Pin
Dave Kreskowiak10-Dec-23 15:31
mveDave Kreskowiak10-Dec-23 15:31 
AnswerRe: write the C# windows form based program that allow user conversion of number system Pin
jschell11-Dec-23 4:36
jschell11-Dec-23 4:36 
QuestionC# multi agent framework based on MS Orleans Pin
Jerome Fortias 20229-Dec-23 5:10
Jerome Fortias 20229-Dec-23 5:10 
AnswerRe: C# multi agent framework based on MS Orleans Pin
Gerry Schmitz9-Dec-23 6:37
mveGerry Schmitz9-Dec-23 6:37 
GeneralRe: C# multi agent framework based on MS Orleans Pin
Jerome Fortias 20229-Dec-23 7:59
Jerome Fortias 20229-Dec-23 7:59 
QuestionMessenger design with C# Pin
parya mardani8-Dec-23 12:05
parya mardani8-Dec-23 12:05 
AnswerRe: Messenger design with C# Pin
Dave Kreskowiak8-Dec-23 14:28
mveDave Kreskowiak8-Dec-23 14:28 
AnswerRe: Messenger design with C# Pin
Gerry Schmitz9-Dec-23 6:35
mveGerry Schmitz9-Dec-23 6:35 
Questionis there any way to get bordercolor same as candle color using ternary in the code below Pin
j k Nov20236-Dec-23 5:48
j k Nov20236-Dec-23 5:48 
AnswerRe: is there any way to get bordercolor same as candle color using ternary in the code below Pin
Gerry Schmitz9-Dec-23 6:32
mveGerry Schmitz9-Dec-23 6:32 
QuestionC# code to chart sometimes charting blank charts Pin
Iskander1234530-Nov-23 16:01
Iskander1234530-Nov-23 16:01 
AnswerRe: C# code to chart sometimes charting blank charts Pin
Ralf Meier30-Nov-23 21:12
mveRalf Meier30-Nov-23 21:12 
GeneralRe: C# code to chart sometimes charting blank charts Pin
Iskander123451-Dec-23 0:52
Iskander123451-Dec-23 0:52 
GeneralRe: C# code to chart sometimes charting blank charts Pin
Ralf Meier1-Dec-23 2:03
mveRalf Meier1-Dec-23 2:03 
GeneralRe: C# code to chart sometimes charting blank charts Pin
Iskander123451-Dec-23 4:43
Iskander123451-Dec-23 4:43 
GeneralRe: C# code to chart sometimes charting blank charts Pin
Ralf Meier1-Dec-23 6:18
mveRalf Meier1-Dec-23 6:18 
SuggestionRe: C# code to chart sometimes charting blank charts Pin
Richard Deeming30-Nov-23 21:56
mveRichard Deeming30-Nov-23 21:56 
Iskander12345 wrote:
C#
string query = $"SELECT * FROM Data WHERE RawDataOrder = {Convert.ToInt32(label86.Text.Trim())}";
Whilst in this specific instance you're probably safe, this sample suggests you're writing code which would be vulnerable to SQL Injection[^].

And even in this case, your code will result in query plan cache pollution - every value for the parameter will result in a different plan being compiled and stored.

Rather than trying to work out whether your values are "safe" to inject into the query, adopt a simple strategy: always use parameters.
C#
const string query = "SELECT * FROM Data WHERE RawDataOrder = @RawDataOrder";
using (SqlCommand command = new SqlCommand(query, connection))
{
    command.Parameters.AddWithValue("@RawDataOrder", Convert.ToInt32(label86.Text.Trim()));
    ...




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer

AnswerRe: C# code to chart sometimes charting blank charts Pin
Richard MacCutchan30-Nov-23 22:15
mveRichard MacCutchan30-Nov-23 22:15 
GeneralRe: C# code to chart sometimes charting blank charts Pin
Iskander123451-Dec-23 0:23
Iskander123451-Dec-23 0:23 
GeneralRe: C# code to chart sometimes charting blank charts Pin
Richard MacCutchan1-Dec-23 2:06
mveRichard MacCutchan1-Dec-23 2:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.