Hi Eric,
I have 2 classes. One is for user to register, get and set
user info. Another one is for user to add product info.
Both of them have static insert method. Insert user info
and product info respectively in 2 different classes.
It is the code of the cs file behind the aspx:
protected Web.User objOperator;
private void Page_Load(object sender, System.EventArgs e)
{
objOperator = (Web.User)Session["UserName"];
if(!IsPostBack)
{
this.Bind_New();
}
}
private void button_Click(object sender, System.EventArgs
e)
{
this.Insert_Data(objOperator);
}
I added breakpoint in button method, I saw that all data
can be passed from webform.
private void Insert_Data(Web.User objOperator)
{
try
{
Web.Product.Insert(
objOperator.UserID,
Int32.Parse(this.AreaID.SelectedItem.Value),
this.Addr.Text,
......
);
}
catch(Exception e)
{
Response.Write(e.Message);
}
I added breakpoint here. All webform data were null. It
said error in getting the values. And, it throws
FormatException. Web.Product.Insert method is a way to
insert web form data to DB through Stored Procedure.
But, I use the same way to do register page, but no error.
Can I pass the value in user object to product?
Anyway to narrow down the finding of the bug? I added
breakpoint in product class, but the program did not stop
to let me see their values.
What's wrong with my code?
Thanks for your advice.
Tom