string s = ConfigurationManager.ConnectionStrings["my"].ConnectionString;
SqlConnection con = new SqlConnection(s);
SqlCommand cmd = new SqlCommand("[dbo].aspnet_Applications_CreateApplication",
con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@ApplicationName", SqlDbType.NVarChar, 256).Value =
txtApplicationName.Text;
SqlParameter param = new SqlParameter("@ApplicationId",
SqlDbType.UniqueIdentifier);
param.Direction = ParameterDirection.Output;
cmd.Parameters.Add(param);
using (con)
{
con.Open();
cmd.ExecuteNonQuery();
}
lblMessage.Text = param.Value.ToString();
string s =
ConfigurationManager.ConnectionStrings["my"].ConnectionString;
SqlConnection con = new SqlConnection(s);
SqlCommand cmd = new SqlCommand("[dbo].aspnet_Users_CreateUser", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@ApplicationId", SqlDbType.UniqueIdentifier).Value = new
Guid(txtApplicationID.Text);
cmd.Parameters.Add("@UserName", SqlDbType.NVarChar, 256).Value =
txtUserName.Text;
cmd.Parameters.Add("@IsUserAnonymous", SqlDbType.Bit).Value =
chkUserAnonymous.Checked;
cmd.Parameters.Add("@LastActivityDate", SqlDbType.DateTime).Value =
DateTime.Parse(txtLastActigityDate.Text);
SqlParameter param = new SqlParameter("@UserId", SqlDbType.UniqueIdentifier);
param.Direction = ParameterDirection.Output;
cmd.Parameters.Add(param);
using (con)
{
con.Open();
cmd.ExecuteNonQuery();
}
lblMessage.Text = param.Value.ToString();