本文整理汇总了C#中Profile.SetUserName方法的典型用法代码示例。如果您正苦于以下问题:C# Profile.SetUserName方法的具体用法?C# Profile.SetUserName怎么用?C# Profile.SetUserName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Profile
的用法示例。
在下文中一共展示了Profile.SetUserName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadFromDataBase
public static Profile LoadFromDataBase(string username)
{
string connstr = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
SqlConnection conn = new SqlConnection(connstr);
string SQLstr;
SQLstr = "SELECT * FROM MemberProfiles WHERE Username='" + username + "'";
conn.Open();
SqlCommand myCmd = new SqlCommand(SQLstr, conn);
myCmd.CommandType = CommandType.Text;
SqlDataReader myReader = myCmd.ExecuteReader();
Profile retProfile = new Profile();
bool read = false;
while (myReader.Read())
{
read = true;
retProfile.MemberID = myReader.GetInt32(0);
retProfile.SetUserName(myReader.GetString(1));
retProfile.SetVisibleUserName(myReader.GetString(2));
retProfile.Password = myReader.GetString(3);
retProfile.Salt = myReader.GetString(4);
retProfile.FirstName = myReader.GetString(5);
retProfile.MiddleInitial = myReader.GetString(6);
retProfile.LastName = myReader.GetString(7);
retProfile.Address = myReader.GetString(8);
retProfile.City = myReader.GetString(9);
retProfile.Region = myReader.GetString(10);
retProfile.PostalCode = myReader.GetString(11);
retProfile.Country = myReader.GetString(12);
retProfile.HomePhone = myReader.GetString(13);
retProfile.WorkPhone = myReader.GetString(14);
retProfile.CellPhone = myReader.GetString(15);
retProfile.Email = myReader.GetString(16);
retProfile.Gender = (GenderType)myReader.GetInt32(17);
retProfile.DateOfBirth = (DateTime)myReader[18];
retProfile.SetJoinDate((DateTime)myReader[19]);
retProfile.ReceiveSpam = myReader.GetBoolean(20);
retProfile.IsAdmin = myReader.GetBoolean(21);
retProfile.MembershipLevel = (MembershipType)myReader.GetInt32(22);
retProfile.OtherMemberships = null; // GetOtherNetworks(retProfile.MemberID);
}
conn.Close();
if (read)
return retProfile;
else
return null;
}