Click here to Skip to main content
12,244,322 members (45,589 online)
Rate this:
 
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 14:47pm
SQLmis314
Comments
jibesh 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
   
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
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160426.1 | Last Updated 25 Dec 2012
Copyright © CodeProject, 1999-2016
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