public static bool SaveSingerInfo(string SingerName,string SingerImage,string Company,string Nationality,string BirthDay,string Stature,string Avoirdupois,string BloodType,string Constellation,string TypesID,string Information)
{
try
{
OperDB db1 = new OperDB();
string sql1 = "insert into SM_SingerInfo (SingerName,SingerImage,Company,Nationality,BirthDay,Stature,Avoirdupois,BloodType,Constellation,TypesID,Information,Favor,AppendTime)";
sql1 = sql1 +" values ('"+SingerName+"','"+SingerImage+"','"+Company+"','"+Nationality+"','"+BirthDay+"',"+Stature+","+Avoirdupois+",'"+BloodType+"','"+Constellation+"',"+TypesID+",'"+Information+"',0,'"+DateTime.Now.ToString()+"')";
db1.Populate(sql1);
return true;
}
catch(Exception exception1)
{
return false;
}
}
bool add = SingerInfo.SaveSingerInfo(singerName,singerImage,company,nationality,birthDay,stature,avoirdupois,bloodType,constellation,typesID,information);
if(add==false)
{
LabelTips.Visible = true;
LabelTips.Text = "提交歌手资料失败!请检查输入是否正确!";
}
else
{
LabelTips.Visible = true;
LabelTips.Text = "恭喜,提交成功歌手["+SingerName.Value+"]";
SingerName.Value = "";
txtImage.Text = "";
Information.InnerText = "";
Avoirdupois.Value = "";
Stature.Value = "";
BirthDay.Value = "";
}
_______________________________________________________________________________
在页面上添加信息,
到数据库中看
添加成功了,
但是页面上却显示
"提交歌手资料失败!请检查输入是否正确!";
搞不懂哪里错了
郁闷中~~~
{
try
{
OperDB db1 = new OperDB();
string sql1 = "insert into SM_SingerInfo (SingerName,SingerImage,Company,Nationality,BirthDay,Stature,Avoirdupois,BloodType,Constellation,TypesID,Information,Favor,AppendTime)";
sql1 = sql1 +" values ('"+SingerName+"','"+SingerImage+"','"+Company+"','"+Nationality+"','"+BirthDay+"',"+Stature+","+Avoirdupois+",'"+BloodType+"','"+Constellation+"',"+TypesID+",'"+Information+"',0,'"+DateTime.Now.ToString()+"')";
db1.Populate(sql1);
return true;
}
catch(Exception exception1)
{
return false;
}
}
bool add = SingerInfo.SaveSingerInfo(singerName,singerImage,company,nationality,birthDay,stature,avoirdupois,bloodType,constellation,typesID,information);
if(add==false)
{
LabelTips.Visible = true;
LabelTips.Text = "提交歌手资料失败!请检查输入是否正确!";
}
else
{
LabelTips.Visible = true;
LabelTips.Text = "恭喜,提交成功歌手["+SingerName.Value+"]";
SingerName.Value = "";
txtImage.Text = "";
Information.InnerText = "";
Avoirdupois.Value = "";
Stature.Value = "";
BirthDay.Value = "";
}
_______________________________________________________________________________
在页面上添加信息,
到数据库中看
添加成功了,
但是页面上却显示
"提交歌手资料失败!请检查输入是否正确!";
搞不懂哪里错了
郁闷中~~~
{
Page.Response.Write(exception1.ToString());
return false;
}
在此方法里已执行 .ExecuteNonQuery() ,但在下面的代码里出现错误
比如:关闭数据连接等建议单步调试,一步一步进入
{
Response.Write(exception1.ToString());
return false;
}