Click here to Skip to main content
15,917,793 members
Home / Discussions / C#
   

C#

 
SuggestionRe: Please help me. don't working save button Pin
Richard Deeming4-Mar-14 23:13
mveRichard Deeming4-Mar-14 23:13 
Start by fixing the SQL Injection vulnerability[^] in your code:
C#
private void btnSave_Click(object sender, EventArgs e)
{
    try
    {
        sc.Open();
        
        using (SqlCommand cmd = new SqlCommand("INSERT INTO emails (id, emails, pbid) VALUES (@id, @emails, @pbid)"))
        {
            cmd.Parameters.AddWithValue("@id", txtId.Text);
            cmd.Parameters.AddWithValue("@emails", txtEm.Text);
            cmd.Parameters.AddWithValue("@pbid", txtPbid.Text);
            cmd.ExecuteNonQuery();
            
            MessageBox.Show("Update Successfull to the database");
        }
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message);
        System.Diagnostics.Debug.WriteLine(ex);
    }
    finally
    {
        sc.Close();
    }
}


If it still doesn't work, you'll need to post the error message. Look in the debug output in Visual Studio to get the full details.



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


GeneralMessage Closed Pin
6-Mar-14 3:15
FesAlex6-Mar-14 3:15 
GeneralRe: Please help me. don't working save button Pin
Pete O'Hanlon6-Mar-14 3:32
mvePete O'Hanlon6-Mar-14 3:32 
GeneralRe: Please help me. don't working save button Pin
thatraja6-Mar-14 3:59
professionalthatraja6-Mar-14 3:59 
GeneralRe: Please help me. don't working save button Pin
bayaa6-Mar-14 16:09
bayaa6-Mar-14 16:09 
GeneralRe: Please help me. don't working save button Pin
bayaa6-Mar-14 16:10
bayaa6-Mar-14 16:10 
AnswerRe: Please help me. don't working save button Pin
Member 104046945-Mar-14 21:18
Member 104046945-Mar-14 21:18 
GeneralRe: Please help me. don't working save button Pin
bayaa6-Mar-14 15:55
bayaa6-Mar-14 15:55 
GeneralRe: Please help me. don't working save button Pin
bayaa6-Mar-14 19:29
bayaa6-Mar-14 19:29 
GeneralRe: Please help me. don't working save button Pin
bayaa6-Mar-14 19:52
bayaa6-Mar-14 19:52 
QuestionInheriting binding list Pin
Gilbert Consellado4-Mar-14 21:52
professionalGilbert Consellado4-Mar-14 21:52 
AnswerRe: Inheriting binding list Pin
BobJanova5-Mar-14 0:56
BobJanova5-Mar-14 0:56 
GeneralRe: Inheriting binding list Pin
Gilbert Consellado5-Mar-14 22:19
professionalGilbert Consellado5-Mar-14 22:19 
GeneralRe: Inheriting binding list Pin
Gilbert Consellado5-Mar-14 22:42
professionalGilbert Consellado5-Mar-14 22:42 
GeneralRe: Inheriting binding list Pin
BobJanova6-Mar-14 6:10
BobJanova6-Mar-14 6:10 
GeneralRe: Inheriting binding list Pin
Gilbert Consellado6-Mar-14 22:05
professionalGilbert Consellado6-Mar-14 22:05 
AnswerRe: Inheriting binding list Pin
Eddy Vluggen6-Mar-14 7:10
professionalEddy Vluggen6-Mar-14 7:10 
GeneralRe: Inheriting binding list Pin
Gilbert Consellado6-Mar-14 22:25
professionalGilbert Consellado6-Mar-14 22:25 
QuestionIs C# is fully object oriented or not? Pin
Member 102864334-Mar-14 21:48
Member 102864334-Mar-14 21:48 
AnswerRe: Is C# is fully object oriented or not? Pin
Peter Leow4-Mar-14 21:59
professionalPeter Leow4-Mar-14 21:59 
GeneralRe: Is C# is fully object oriented or not? Pin
BobJanova5-Mar-14 0:39
BobJanova5-Mar-14 0:39 
AnswerRe: Is C# is fully object oriented or not? Pin
OriginalGriff4-Mar-14 22:14
mveOriginalGriff4-Mar-14 22:14 
AnswerRe: Is C# is fully object oriented or not? Pin
BillWoodruff4-Mar-14 23:08
professionalBillWoodruff4-Mar-14 23:08 
GeneralRe: Is C# is fully object oriented or not? Pin
harold aptroot5-Mar-14 1:21
harold aptroot5-Mar-14 1:21 
JokeRe: Is C# is fully object oriented or not? PinPopular
Wayne Gaylard5-Mar-14 1:37
professionalWayne Gaylard5-Mar-14 1:37 

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.