HI,
I try to save data to SQL Server 2005 and it's not pick up some special characters, specialy single quetes .
Is anybody on my code sample can show me how to do this
Thanks
This is my code sample:
protected void btnSubmit_Click (object sender, EventArgs e)
{
try
{
int userId = Convert.ToInt32 (Session["LoggedUser Id"]);
if (userId == 0)
{
lblError.Text = "Your Session Expired. Please Login Again.";
return;
}
UserBO objUserBO = new UserBO();
objUserBO.UserI d = Convert.ToInt32 (Session["LoggedUser Id"]);
objUserBO.HeadL ine = txtHeadLine.Tex t;
objUserBO.First Name = txtFirstName.Te xt;
objUserBO.LastN ame = txtLastName.Tex t;
objUserBO.Addre ss = txtAddress.Text ;
objUserBO.City = txtCity.Text;
objUserBO.State = txtState.Text;
objUserBO.ZipCo de = txtZipCode.Text ;
objUserBO.About Me = txtAboutMe.Text ;
objUserBO.Phone = txtPhone.Text;
objUserBO.Websi te = txtWebsite.Text ;
objUserBO.Blog = txtBlog.Text;
objUserBO.Busin essProfileLink = lblBusinessProf ileLink.Text;
objUserBO.MySer viceInfo = txtServiceInfo. Text;
objUserBO.MySer viceValueReason = txtServiceValue Reason.Text;
objUserBO.MoreP icsLink = txtPicturesLink .Text;
objUserBO.Video Link = txtVideosLink.T ext;
objUserBO.Categ ory = ddCategory.Sele ctedItem.ToStri ng();
objUserBO.SubCa tegory = ddSubCategory.S electedItem.ToS tring();
objUserBO.Searc hKeywords = txtSearchKeywor ds.Text.ToStrin g();
objUserBO.Busin essName = txtBusinessName .Text.ToString( );
objUserBO.Speci alOffer = txtSpecialOffer .Text;
bool success = objUserDL.Updat eUser(objUserBO );
if (success)
{
lblError.Text = "Profile Info Successfully Updated.";
btnPreview.Enab led = true;
}
else
lblError.Text = "Profile Info Could Not Be Updated. Please Try Later";
}
catch (Exception ex)
{
lblError.Text = "Profile Info Could Not Be Updated. Please Try Later";
}
}
I try to save data to SQL Server 2005 and it's not pick up some special characters, specialy single quetes .
Is anybody on my code sample can show me how to do this
Thanks
This is my code sample:
protected void btnSubmit_Click (object sender, EventArgs e)
{
try
{
int userId = Convert.ToInt32 (Session["LoggedUser Id"]);
if (userId == 0)
{
lblError.Text = "Your Session Expired. Please Login Again.";
return;
}
UserBO objUserBO = new UserBO();
objUserBO.UserI d = Convert.ToInt32 (Session["LoggedUser Id"]);
objUserBO.HeadL ine = txtHeadLine.Tex t;
objUserBO.First Name = txtFirstName.Te xt;
objUserBO.LastN ame = txtLastName.Tex t;
objUserBO.Addre ss = txtAddress.Text ;
objUserBO.City = txtCity.Text;
objUserBO.State = txtState.Text;
objUserBO.ZipCo de = txtZipCode.Text ;
objUserBO.About Me = txtAboutMe.Text ;
objUserBO.Phone = txtPhone.Text;
objUserBO.Websi te = txtWebsite.Text ;
objUserBO.Blog = txtBlog.Text;
objUserBO.Busin essProfileLink = lblBusinessProf ileLink.Text;
objUserBO.MySer viceInfo = txtServiceInfo. Text;
objUserBO.MySer viceValueReason = txtServiceValue Reason.Text;
objUserBO.MoreP icsLink = txtPicturesLink .Text;
objUserBO.Video Link = txtVideosLink.T ext;
objUserBO.Categ ory = ddCategory.Sele ctedItem.ToStri ng();
objUserBO.SubCa tegory = ddSubCategory.S electedItem.ToS tring();
objUserBO.Searc hKeywords = txtSearchKeywor ds.Text.ToStrin g();
objUserBO.Busin essName = txtBusinessName .Text.ToString( );
objUserBO.Speci alOffer = txtSpecialOffer .Text;
bool success = objUserDL.Updat eUser(objUserBO );
if (success)
{
lblError.Text = "Profile Info Successfully Updated.";
btnPreview.Enab led = true;
}
else
lblError.Text = "Profile Info Could Not Be Updated. Please Try Later";
}
catch (Exception ex)
{
lblError.Text = "Profile Info Could Not Be Updated. Please Try Later";
}
}
Comment