|
[x]
Posted via EE Mobile
|
||
Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
||
| 11/04/2009 at 06:31PM PST, ID: 24873312 | Points: 500 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Security.AccessControl;
using System.Web.Security;
using System.Configuration;
using System.Data.SqlClient;
public partial class Models_CreateProfile : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
// Get the UserId of the logged in user
MembershipUser CurrentUser = Membership.GetUser(User.Identity.Name);
//Get Profile Data Entered by user in TextBox
String sn = StageName.Text;
String fn = FirstName.Text;
String ln = LastName.Text;
// Insert a new record into Profile
// Get your Connection String from the web.config
string connectionString = ConfigurationManager.ConnectionStrings["LocalSqlServer"].ConnectionString; string insertSql = "INSERT INTO Profile(StageName,FirstName, LastName) VALUES(@StageName,@FirstName, @LastName)";
using (SqlConnection myConnection = new SqlConnection(connectionString))
{
myConnection.Open();
SqlCommand myCommand = new SqlCommand(insertSql, myConnection);
//myCommand.Parameters.AddWithValue("@UserId", UserId);
myCommand.Parameters.AddWithValue("@StageName", sn);
myCommand.Parameters.AddWithValue("@FirstName", fn);
myCommand.Parameters.AddWithValue("@LastName", ln);
myCommand.ExecuteNonQuery();
myConnection.Close();
}
}
}
|
Advertisement