我在第一頁兩個註冊頁面我插入必填字段之後,我更新使用userid其他一些細節......用戶ID是在DB一個標識列,所以我的更新存儲過程無法更新DB值
ALTER procedure [dbo].[sp_update]
(@id int,@FormFiledBy varchar (50),@MaritalStatus varchar (50),@Height varchar (50),
@Religion varchar (50),@Caste varchar (100),
@MotherTongue varchar(50),@Education varchar (100),@Occupation varchar(50),
@CountryofResidence varchar (50),@EducationDetails varchar (100),@AnnualIncome varchar(50),
@CountryOfBirth varchar(50),@BirthPlace varchar(50),@TimeOfBirth nchar(10),@StarSign varchar (100),
@Gothram varchar (50),@Rassi varchar(50),@HavinChildren varchar(10),@PhysicalStatus varchar (100))
as
begin
update Profile_Master
set [email protected],[email protected],[email protected],
[email protected],[email protected],[email protected],
[email protected],[email protected],[email protected],[email protected],
[email protected],[email protected],[email protected],[email protected],
[email protected],[email protected],[email protected],[email protected],[email protected]
where [email protected]
return
end
在我DAL
public static int update(ProfileMasterBLL profileMasterBLL)
{
string userid = ProfileMasterDAL.GetUserIdByEmailID(profileMasterBLL.EmailID);
SqlConnection conn = Generic.DBConnection.OpenConnection();
try
{
SqlCommand cmdd = new SqlCommand("sp_update", conn);
cmdd.CommandType = CommandType.StoredProcedure;
cmdd.Parameters.AddWithValue("@FormFiledBy", profileMasterBLL.FormFiledBy);
cmdd.Parameters.AddWithValue("@MaritalStatus", profileMasterBLL.MaritalStatus);
cmdd.Parameters.AddWithValue("@Height", profileMasterBLL.Height);
cmdd.Parameters.AddWithValue("@Religion", profileMasterBLL.Religion);
cmdd.Parameters.AddWithValue("@Caste", profileMasterBLL.Caste);
cmdd.Parameters.AddWithValue("@Education", profileMasterBLL.Education);
cmdd.Parameters.AddWithValue("@Occupation", profileMasterBLL.Occupation);
cmdd.Parameters.AddWithValue("@CountryofResidence", profileMasterBLL.CountryofResidence);
cmdd.Parameters.AddWithValue("@EducationDetails", profileMasterBLL.EducationDetails);
cmdd.Parameters.AddWithValue("@CountryOfBirth", profileMasterBLL.CountryOfBirth);
cmdd.Parameters.AddWithValue("@BirthPlace", profileMasterBLL.BirthPlace);
在我的UI
protected void Button1_Click(object sender, EventArgs e)
{
// Get User ID from DAL
int chk = 0;
if (Session["EmailID"] != null)
{
emailID = Session["EmailID"].ToString();
}
ProfileMasterBLL prfbll = new ProfileMasterBLL();
string userid = ProfileMasterDAL.GetUserIdByEmailID(emailID);
我能夠在這裏得到的用戶ID,但一壓腳提升這個
chk = ProfileMasterDAL.update(prfbll);
在這裏斷點跳轉到更新的方法和我得到EMAILID爲空,所以我amgetting用戶ID也爲null對此有何幫助?
在我BAL
public class ProfileMasterBLL
{
public int UserId { get; set; }
public string FormFiledBy { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string Gender { get; set; }
public string MaritalStatus { get; set; }
public string HavinChildren { get; set; }
public string EmailID { get; set; }
}
在我的第一頁
我正在追趕會話值
Session["EmailID"] = TextBox8.Text;
那是哪裏設置會話變量的代碼?這聽起來像問題可能在那裏。 – FJT 2012-08-13 17:25:24
emailid來自第一頁... – 2012-08-13 17:29:16
如果您的Session [「EmailID」]爲空,會發生什麼情況? 您的代碼使用空字符串或空字符串調用更新。 – Steve 2012-08-13 17:42:15