Click here to Skip to main content
15,889,335 members
Home / Discussions / C#
   

C#

 
QuestionRemove Dynamically Created Controls Pin
Django_Untaken26-Nov-14 1:58
Django_Untaken26-Nov-14 1:58 
AnswerRe: Remove Dynamically Created Controls Pin
OriginalGriff26-Nov-14 2:38
mveOriginalGriff26-Nov-14 2:38 
AnswerRe: Remove Dynamically Created Controls Pin
BillWoodruff26-Nov-14 9:58
professionalBillWoodruff26-Nov-14 9:58 
QuestionImage source BitmapImage update problem Pin
massisoda25-Nov-14 22:40
massisoda25-Nov-14 22:40 
AnswerRe: Image source BitmapImage update problem Pin
M.Scheeren1-Dec-14 22:48
professionalM.Scheeren1-Dec-14 22:48 
Questionhow to retrieve only date from datetime from database Pin
Member 1126447925-Nov-14 18:54
Member 1126447925-Nov-14 18:54 
AnswerRe: how to retrieve only date from datetime from database Pin
Pete O'Hanlon25-Nov-14 19:20
mvePete O'Hanlon25-Nov-14 19:20 
SuggestionRe: how to retrieve only date from datetime from database Pin
Richard Deeming26-Nov-14 1:37
mveRichard Deeming26-Nov-14 1:37 
Member 11264479 wrote:
SqlCommand cmd = new SqlCommand("Select * from ApplicantForm Where ApplicantId=" + ((Request.QueryString["ApplicantId"])) + "", con);

This code is vulnerable to SQL Injection[^].

NEVER use string concatenation to build a SQL query. ALWAYS use a parameterized query.

C#
using (SqlCommand cmd = new SqlCommand("SELECT dob FROM ApplicantForm WHERE ApplicantId = @ApplicantId", con))
{
    cmd.Parameters.AddWithValue("@ApplicantId", Request.QueryString["ApplicantId"]);
    
    object dob = cmd.ExecuteScalar();
    if (dob != null && !Convert.IsDBNull(dob))
    {
        txtDOB.Text = string.Format("{0:d}", dob);
    }
}




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


QuestionWindows mobile App with VS2013 C# Pin
Member 1068390225-Nov-14 8:22
Member 1068390225-Nov-14 8:22 
AnswerRe: Windows mobile App with VS2013 C# Pin
Richard MacCutchan25-Nov-14 22:24
mveRichard MacCutchan25-Nov-14 22:24 
GeneralRe: Windows mobile App with VS2013 C# Pin
Member 1068390226-Nov-14 9:58
Member 1068390226-Nov-14 9:58 
QuestionC sharp Pin
Sarita S24-Nov-14 23:50
Sarita S24-Nov-14 23:50 
AnswerRe: C sharp Pin
den2k8825-Nov-14 0:00
professionalden2k8825-Nov-14 0:00 
GeneralRe: C sharp Pin
Sarita S25-Nov-14 0:10
Sarita S25-Nov-14 0:10 
GeneralRe: C sharp Pin
den2k8825-Nov-14 0:24
professionalden2k8825-Nov-14 0:24 
GeneralRe: C sharp Pin
Nicholas Marty25-Nov-14 0:28
professionalNicholas Marty25-Nov-14 0:28 
GeneralRe: C sharp Pin
Sarita S25-Nov-14 0:35
Sarita S25-Nov-14 0:35 
GeneralRe: C sharp Pin
Eddy Vluggen25-Nov-14 0:20
professionalEddy Vluggen25-Nov-14 0:20 
AnswerRe: C sharp Pin
Eddy Vluggen25-Nov-14 0:21
professionalEddy Vluggen25-Nov-14 0:21 
AnswerRe: C sharp Pin
Simon_Whale25-Nov-14 0:23
Simon_Whale25-Nov-14 0:23 
AnswerRe: C sharp Pin
OriginalGriff25-Nov-14 0:24
mveOriginalGriff25-Nov-14 0:24 
AnswerRe: C sharp Pin
Bernhard Hiller25-Nov-14 5:08
Bernhard Hiller25-Nov-14 5:08 
AnswerRe: C sharp Pin
4a616e25-Nov-14 10:11
4a616e25-Nov-14 10:11 
AnswerRe: C sharp Pin
V.27-Nov-14 1:58
professionalV.27-Nov-14 1:58 
QuestionC# - Read App.Config file Pin
Member 1123932724-Nov-14 20:48
Member 1123932724-Nov-14 20:48 

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.