新手请教一问题用户代码未处理 System.Data.SqlClient.SqlException
using System;using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class Expert_TxtDeal : System.Web.UI.Page
{
private static string strConnect = System.Configuration.ConfigurationManager.AppSettings["connStr"];
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Session["ExpertName"] != null)
{
List();
}
else
{
Response.Redirect("ExpertLogin.aspx");
}
}
}
private void List()//显示稿件细节
{//绑定稿件数据
string Id = Request.QueryString["ID"];
SqlConnection sqlcon = new SqlConnection(strConnect);
string sqlstr = "select * from Gaojian where TxtId ='" + Id + "'";
sqlcon.Open();
SqlCommand sqlcmd2 = new SqlCommand(sqlstr, sqlcon);
sqlcmd2.Parameters.Add("@TxtId", SqlDbType.VarChar);
sqlcmd2.Parameters["@TxtId"].Value = Request.QueryString["Id"].ToString();
SqlDataReader sdr = sqlcmd2.ExecuteReader();
if (sdr.Read())
{
this.LabId.Text = Convert.ToString(sdr["TxtId"]);
this.LabClass.Text = Convert.ToString(sdr["Classname"]);
this.LabTitle.Text = Convert.ToString(sdr["TxtTitle"]);
this.LabAuthor.Text = Convert.ToString(sdr["AuthorName"]);
this.LabStage.Text = "同意审评";
this.LabShenTime.Text = DateTime.Now.ToString();
// Session["download"] = Convert.ToString(".." + "/" + sdr["FilePath"]);
//this.HlinkQuanWen.NavigateUrl = Session["download"].ToString();
}
sqlcon.Close();
}
protected void LbtnHand_Click(object sender, EventArgs e)
{
string Id = Request.QueryString["ID"];
SqlConnection sqlcon = new SqlConnection(strConnect);
SqlCommand sqlcmd = new SqlCommand("", sqlcon);
sqlcon.Open();
=
"Update Gaojian Set ExamStage=@ExamStage,LModiDate=@LModiDate,ExamOpinion=@ExamOpinion,TitleIdea=@TitleIdea,FieldIdea=@FieldIdea,ScienceLev=@ScienceLev,TxtValue=@TxtValue,TitleCharm=@TitleCharm,EgTlLeval=@EgTlLeval,IntroReal=@IntroReal,ContLev=@ContLev ,PointLev=@PointLev,GarphLev=@GarphLev,RefBook=@RefBook ,ExamResult=@ExamResult Where TxtId='"+ Id +"'";
sqlcmd.Parameters.Add("ExamStage", SqlDbType.VarChar);
sqlcmd.Parameters.Add("LModiDate", SqlDbType.VarChar);
sqlcmd.Parameters.Add("ExamOpinion", SqlDbType.VarChar);
sqlcmd.Parameters.Add("TitleIdea", SqlDbType.VarChar);
sqlcmd.Parameters.Add("FieldIdea", SqlDbType.VarChar);
sqlcmd.Parameters.Add("ScienceLev", SqlDbType.VarChar);
sqlcmd.Parameters.Add("TxtValue", SqlDbType.VarChar);
sqlcmd.Parameters.Add("TitleCharm", SqlDbType.VarChar);
sqlcmd.Parameters.Add("EgTlLeval", SqlDbType.VarChar);
sqlcmd.Parameters.Add("IntroReal", SqlDbType.VarChar);
sqlcmd.Parameters.Add("ContLev", SqlDbType.VarChar);
sqlcmd.Parameters.Add("PointLev", SqlDbType.VarChar);
sqlcmd.Parameters.Add("GarphLev", SqlDbType.VarChar);
sqlcmd.Parameters.Add("RefBook", SqlDbType.VarChar);
sqlcmd.Parameters.Add("ExamResult", SqlDbType.VarChar);
string yishen = "已审";
sqlcmd.Parameters["ExamStage"].Value=yishen.ToString();
sqlcmd.Parameters["LModiDate"].Value=DateTime.Now;
sqlcmd.Parameters["ExamOpinion"].Value=txtOpinion.Text;
sqlcmd.Parameters["TitleIdea"].Value=Rbtnxinyin.SelectedItem.Text.Trim();
sqlcmd.Parameters["FieldIdea"].Value=RbtnCdu.SelectedItem.Text.Trim();
sqlcmd.Parameters["ScienceLev"].Value=RbtnLevel.SelectedItem.Text.Trim();
sqlcmd.Parameters["TxtValue"].Value=RbtnYIyi.SelectedItem.Text.Trim();
sqlcmd.Parameters["TitleCharm"].Value=RbtnXiyin.SelectedItem.Text.Trim();
sqlcmd.Parameters["EgTlLeval"].Value=RbtnZhiLiang.SelectedItem.Text.Trim();
sqlcmd.Parameters["IntroReal"].Value=RbtnQYan.SelectedItem.Text.Trim();
sqlcmd.Parameters["ContLev"].Value=RbtnNeiRong.SelectedItem.Text.Trim();
sqlcmd.Parameters["PointLev"].Value=RbtnLunDian.SelectedItem.Text.Trim();
sqlcmd.Parameters["GarphLev"].Value=RbtnTuBiao.SelectedItem.Text.Trim();
sqlcmd.Parameters["RefBook"].Value=RbtnCanKao.SelectedItem.Text.Trim();
sqlcmd.Parameters["ExamResult"].Value=RbtnResult.SelectedItem.Text.Trim();
sqlcmd.ExecuteNonQuery();
sqlcon.Close();
Response.Write("<script language=javascript>alert('提交成功!');location.href='DaiShenGaoJian.aspx'</script>");
}
protected void LinkButton2_Click(object sender, EventArgs e)
{
string Id = Request.QueryString["ID"];
SqlConnection sqlcon = new SqlConnection(strConnect);
SqlCommand sqlcmd = new SqlCommand("", sqlcon);
sqlcon.Open();
=
"Update Gaojian set ExamStage='送审' Where TxtId='" + Id + "'";
sqlcmd.ExecuteNonQuery();
sqlcon.Close();
Response.Redirect("DaiShenGaoJian.aspx");
}
}