SqlDataSource InsertParameters问题
hz890 2007-04-25 11:06:35 SqlDataSource1.InsertParameters["userId"].DefaultValue = Session["userid"].ToString();
Session["userid"].ToString()的值为“109EFDDD-9CAB-4CE1-BBFB-EE07021F9A96”
而执行插入时报错:
无法将 NULL 值插入列 'userId',表 'Test1.dbo.AddressLists';该列不允许空值。INSERT 失败。语句已终止。
是何原因??
还有:
SqlDataSource1.InsertParameters["frdPhone"].DefaultValue = txtTel.Text.Trim();
当txtTel.Text.Trim()为""时,报错:
无法将 NULL 值插入列"Tel",表 'Test1.dbo.Tel';该列不允许空值。INSERT 失败。语句已终止。
""并不等同于Null ,不明白?