提示SQL语句有问题,怎么样查看SQL找问题
SqlCommand cmd = new SqlCommand("insert into RL_Article(Sortid,TitleIntact,Author,CopyFrom,Keyword,Intro,RLContent,State,Ontop,UpdateTime,RLLinks,Imgurl,Hits) values(" + isortid + ",'" + TxtTitle.Text + "','" + TxtAuthor.Text + "','" + TxtFrom.Text + "','" + TxtKeywords.Text + "','" + TxtDescription.Text + "','" + RLContent + "'," + ListIsbest.Text + "," + ListOntop.Text + ",'" + mytime + "','" + Txtlinks.Text + "','" + Txtimg.Text + "'," + TxtHits.Text + ")", con);
       类似ASP里 
Response.write sql
Response.end()请指教

解决方案 »

  1.   

    断点调试运行到这里就可以查看组装的sql语句了 
      

  2.   

    string sql = "insert into RL_Article(Sortid,TitleIntact,Author,CopyFrom,Keyword,Intro,RLContent,State,Ontop,UpdateTime,RLLinks,Imgurl,Hits) values(" + isortid + ",'" + TxtTitle.Text + "','" + TxtAuthor.Text + "','" + TxtFrom.Text + "','" + TxtKeywords.Text + "','" + TxtDescription.Text + "','" + RLContent + "'," + ListIsbest.Text + "," + ListOntop.Text + ",'" + mytime + "','" + Txtlinks.Text + "','" + Txtimg.Text + "'," + TxtHits.Text + ")";
    SqlCommand cmd = new SqlCommand(sql, conn);查看SQL 设置断点就可以了啊
    也可以再命令窗口 ? sql 查看
      

  3.   

     int isortid = Convert.ToInt32(this.DrpSortid.SelectedValue);
            string RLContent = Request["editor1"].ToString();
            DateTime mytime = DateTime.Now;
            SqlConnection con = new SqlConnection(connStr);
            con.Open();
            SqlCommand cmd = new SqlCommand("insert into RL_Article(Sortid,TitleIntact,Author,CopyFrom,Keyword,Intro,RLContent,State,Ontop,UpdateTime,RLLinks,Imgurl,Hits) values(" + isortid + ",'" + TxtTitle.Text + "','" + TxtAuthor.Text + "','" + TxtFrom.Text + "','" + TxtKeywords.Text + "','" + TxtDescription.Text + "','" + RLContent + "'," + ListIsbest.Text + "," + ListOntop.Text + ",'" + mytime + "','" + Txtlinks.Text + "','" + Txtimg.Text + "'," + TxtHits.Text + ")", con);
            cmd.ExecuteNonQuery();
            con.Close();
      

  4.   

    ," + TxtHits.Text + ")
    这个如果是空的话 SQL语句就是,),结束了  给分
      

  5.   

    一般用sql自带的事件探查器看