[求助]SQL为什么只能保存第一个字符?
麻烦大侠帮个忙
我用的是VS.net 03和sql server2000,用存储过程保存数据是为什么只能保存textbox里面的第一个字符?
比如像下图填好表单,提交后
查看数据库中对应列只保存每一格textbox里的第一个字符
这个是怎么回事?
存储过程:
CREATE procedure useradd
@UID varchar,
@UPassword varchar,
@UQuestion nvarchar,
@UAnswer nvarchar,
@USex bit,
@UCityID int,
@Email varchar
AS
insert into Users(UID, UPassword, UQuestion, UAnswer, UPower, USex, UCityID, Email)values
(@UID,
@UPassword,
@UQuestion,
@UAnswer,
2,
@USex,
@UCityID,
@Email)
调用:
cm.Parameters.Add("@UID", SqlDbType.VarChar);
cm.Parameters.Add("@UPassword", SqlDbType.VarChar);
cm.Parameters.Add("@UQuestion", SqlDbType.VarChar);
cm.Parameters.Add("@UAnswer", SqlDbType.VarChar);
cm.Parameters.Add("@USex", SqlDbType.Bit);
cm.Parameters.Add("@UCityID", SqlDbType.Int);
cm.Parameters.Add("@Email", SqlDbType.VarChar);
cm.Parameters["@UID"].Value = tbx_uid.Text;
cm.Parameters["@UPassword"].Value = tbx_password.Text;
cm.Parameters["@UQuestion"].Value = tbx_uquestion.Text;
cm.Parameters["@UAnswer"].Value = tbx_uanswer.Text;
if(rtn_male.Checked)
cm.Parameters["@USex"].Value = 1;
else
cm.Parameters["@USex"].Value = 0;
cm.Parameters["@UCityID"].Value = ddl_ucityid.SelectedItem.Value;
cm.Parameters["@Email"].Value = tbx_uemail.Text;
cm.ExecuteNonQuery();
[此贴子已经被作者于2006-7-31 0:40:05编辑过]