提示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()请指教
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()请指教
SqlCommand cmd = new SqlCommand(sql, conn);查看SQL 设置断点就可以了啊
也可以再命令窗口 ? sql 查看
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();
这个如果是空的话 SQL语句就是,),结束了 给分