Posted on: 11/12/2012 1:05:54 AM | Views : 368


protected void Button1_Click(object sender, EventArgs e)
{

MembershipUser currentUser = Membership.GetUser();
Guid currentUserId = (Guid)currentUser.ProviderUserKey;
string stremail = Membership.GetUser().Email;

string mail = Request.QueryString.Get("Email");
SqlConnection conn;
SqlCommand comm;
string connectionString = @"";
conn = new SqlConnection(connectionString);
comm = new SqlCommand("INSERT INTO request(UserId,PRODUCTID,to,from,description) " + "VALUES(@UserId,@PRODUCTID,@to,@from,@description)", conn);

comm.Parameters.AddWithValue("@UserId", currentUserId);
comm.Parameters.AddWithValue("@from", stremail);
comm.Parameters.AddWithValue("@to", mail);
comm.Parameters.Add("@PRODUCTID", System.Data.SqlDbType.Int);
comm.Parameters["@PRODUCTID"].Value = txtprodno.Text;
comm.Parameters.Add("@description", System.Data.SqlDbType.NVarChar,500);
...

Go to the complete details ...