Click here to Skip to main content
15,887,175 members
Home / Discussions / C#
   

C#

 
GeneralRe: Need to send an email 20 minutes before the event time Pin
SledgeHammer013-Oct-14 11:46
SledgeHammer013-Oct-14 11:46 
GeneralRe: Need to send an email 20 minutes before the event time Pin
VladFromNYC6-Oct-14 4:48
VladFromNYC6-Oct-14 4:48 
QuestionHow to find in useful/unnecessary files from website folder ??? Pin
Abhishek kumar1213-Oct-14 6:07
Abhishek kumar1213-Oct-14 6:07 
AnswerRe: How to find in useful/unnecessary files from website folder ??? Pin
ZurdoDev3-Oct-14 7:12
professionalZurdoDev3-Oct-14 7:12 
QuestionEdit Equation in RichtextBox WPF Pin
Member 106106383-Oct-14 3:53
Member 106106383-Oct-14 3:53 
AnswerRe: Edit Equation in RichtextBox WPF Pin
SledgeHammer013-Oct-14 6:59
SledgeHammer013-Oct-14 6:59 
QuestionWhat should be update query ??? Pin
Abhishek kumar1213-Oct-14 1:42
Abhishek kumar1213-Oct-14 1:42 
AnswerRe: What should be update query ??? Pin
Richard Deeming3-Oct-14 2:23
mveRichard Deeming3-Oct-14 2:23 
Your code is susceptible to SQL Injection[^]. Update it to use a parameterized query:
C#
using (SqlConnection con = new SqlConnection("..."))
using (SqlCommand com = new SqlCommand("UPDATE tblRegistration SET Qualification = @Qualification, Qualification_Point = @Qualification_Point WHERE username = @UserName", con))
{
    com.Parameters.AddWithValue("@Qualification", Qualification_DropDownList.SelectedItem.Text);
    com.Parameters.AddWithValue("@Qualification_Point", Qualification_DropDownList.SelectedValue);
    com.Parameters.AddWithValue("@UserName", UserName);
    
    con.Open();
    com.ExecuteNonQuery();
}


As to why you're updating the wrong qualification, the problem is that your DropDownList contains items with the same value. When the form is posted back to the server, only the value of the selected item is sent - for example, "3". The server has no way to determine which item with the value "3" was selected, and so it chooses the first one.

The only way to fix the problem is to ensure that each item in the list has a unique value. That means you'll need to get the points from somewhere else - probably using the same source that you're currently using to populate the list.



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


QuestionConverting Crystal Reports into Bitmap format Pin
itani1-Oct-14 20:03
itani1-Oct-14 20:03 
QuestionRe: Converting Crystal Reports into Bitmap format Pin
Richard MacCutchan1-Oct-14 21:43
mveRichard MacCutchan1-Oct-14 21:43 
AnswerRe: Converting Crystal Reports into Bitmap format Pin
Bernhard Hiller1-Oct-14 23:18
Bernhard Hiller1-Oct-14 23:18 
GeneralRe: Converting Crystal Reports into Bitmap format Pin
Richard MacCutchan1-Oct-14 23:19
mveRichard MacCutchan1-Oct-14 23:19 
AnswerRe: Converting Crystal Reports into Bitmap format Pin
Marco Bertschi1-Oct-14 23:57
protectorMarco Bertschi1-Oct-14 23:57 
GeneralRe: Converting Crystal Reports into Bitmap format Pin
Richard MacCutchan2-Oct-14 3:50
mveRichard MacCutchan2-Oct-14 3:50 
GeneralRe: Converting Crystal Reports into Bitmap format Pin
jschell3-Oct-14 9:18
jschell3-Oct-14 9:18 
GeneralRe: Converting Crystal Reports into Bitmap format Pin
Marco Bertschi4-Oct-14 2:17
protectorMarco Bertschi4-Oct-14 2:17 
GeneralRe: Converting Crystal Reports into Bitmap format Pin
jschell6-Oct-14 10:01
jschell6-Oct-14 10:01 
AnswerRe: Converting Crystal Reports into Bitmap format Pin
Gerry Schmitz3-Oct-14 4:48
mveGerry Schmitz3-Oct-14 4:48 
AnswerRe: Converting Crystal Reports into Bitmap format Pin
Pete O'Hanlon1-Oct-14 23:50
mvePete O'Hanlon1-Oct-14 23:50 
GeneralRe: Converting Crystal Reports into Bitmap format Pin
Marco Bertschi1-Oct-14 23:54
protectorMarco Bertschi1-Oct-14 23:54 
AnswerRe: Converting Crystal Reports into Bitmap format Pin
Marco Bertschi1-Oct-14 23:52
protectorMarco Bertschi1-Oct-14 23:52 
QuestionUsing generics without the caller knowing what type to expect Pin
Jörgen Andersson1-Oct-14 9:00
professionalJörgen Andersson1-Oct-14 9:00 
AnswerRe: Using generics without the caller knowing what type to expect Pin
Eddy Vluggen1-Oct-14 9:07
professionalEddy Vluggen1-Oct-14 9:07 
GeneralRe: Using generics without the caller knowing what type to expect Pin
Jörgen Andersson1-Oct-14 21:14
professionalJörgen Andersson1-Oct-14 21:14 
GeneralRe: Using generics without the caller knowing what type to expect Pin
PIEBALDconsult1-Oct-14 9:41
mvePIEBALDconsult1-Oct-14 9:41 

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.