Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
   public static string Newmember(string mname, int password, string email)
    {
      
        SqlConnection con = new SqlConnection(Database.ConnectionString);
        try
        {
            SqlCommand cmd = new SqlCommand("select isnull(max(mid),0)+1 from members", con);
            int mid = (int)cmd.ExecuteScalar();
 
            cmd.CommandText = "insert into members values(@mid,@mname,@password,@email)";
            cmd.Parameters.Add("@mid", SqlDbType.Int).Value = mid;
            cmd.Parameters.Add("@mname", SqlDbType.VarChar, 50).Value = mname;
            cmd.Parameters.Add("@password", SqlDbType.Int).Value = password;
            cmd.Parameters.Add("@email", SqlDbType.VarChar, 40).Value = email;
            cmd.ExecuteNonQuery();
            HttpContext.Current.Trace.Write("Member has been added successfully with ID = " + mid +"\n "+"your name is" +mname +" " +"your password is"+password+" "+"your email is "+ email);
            
        }
        catch (Exception ex)
        {
            HttpContext.Current.Trace.Write("error" + ex.Message);
     
        }
        finally
        {
            con.Close();
        }
Posted 24-Dec-12 13:47pm
SQLmis314
Comments
jibesh at 24-Dec-12 23:07pm
   
why are you posting the same question again and again. I have found 2 Query with same questions
 
http://www.codeproject.com/Questions/514610/howplustopluswriteplusthispluscode-3f
http://www.codeproject.com/Questions/514683/c-23pluscodingplusproblemplusthatplusiplusneedplus
 
and both of them are marked as resolved why? If the answer didnt satisfy your query you can ask more question in the same thread itself. you can always use the 'Improve Question' link at the right bottom of your question to modify your question.
 
do not overpopulate CP with redundant questions
Sergey Alexandrovich Kryukov at 25-Dec-12 0:02am
   
How is this code related to the question? :-)
—SA

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

It could be something like
myButton.Click += (sender, eventArgs) => { TheMethodToExecute(/* ... */); }
 
—SA
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 271
1 OriginalGriff 253
2 nv3 50
3 VJ Reddy 45
4 Mehdi Gholam 45
0 Sergey Alexandrovich Kryukov 6,696
1 OriginalGriff 6,149
2 CPallini 2,473
3 Richard MacCutchan 1,697
4 Abhinav S 1,560


Advertise | Privacy | Mobile
Web04 | 2.8.140821.2 | Last Updated 25 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100