Click here to Skip to main content
12,819,538 members (34,095 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);
            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;
            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);
Posted 24-Dec-12 14:47pm
jibesh 24-Dec-12 23:07pm
why are you posting the same question again and again. I have found 2 Query with same questions

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? :-)

1 solution

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

Solution 1

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


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.170308.1 | Last Updated 25 Dec 2012
Copyright © CodeProject, 1999-2017
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