求救,异常详细信息: System.Data.SqlClient.SqlException: 第 1 行: '=' 附近有语法错误。

古古 2007-02-07 11:35:35
这是我的代码:
求救,第1行有错误!!!
这是我的代码
protected void Page_Load(object sender, System.EventArgs e)
{
SqlConnection ST_myConn = new SqlConnection();
string ST_dns = ConfigurationSettings.AppSettings["strConn"];
ST_myConn.ConnectionString = ST_dns;

string ST_sql = "select * from B_news where B_id=" + Request.QueryString["id"] + "";

SqlDataAdapter ST_myCmd = new SqlDataAdapter(ST_sql, ST_myConn);

DataSet ST_ds = new DataSet();
ST_myCmd.Fill(ST_ds, "NewsCheck");
NewsShow.DataSource = ST_ds.Tables[0].DefaultView;
NewsShow.DataBind();
}


执行的时候提示异常详细信息: 异常详细信息: System.Data.SqlClient.SqlException: 第 1 行: '=' 附近有语法错误。

源错误:


行 38:
行 39: DataSet ST_ds = new DataSet();
行 40: ST_myCmd.Fill(ST_ds, "NewsCheck");
行 41: NewsShow.DataSource = ST_ds.Tables[0].DefaultView;
行 42: NewsShow.DataBind();

请问这是怎么回事啊?????
...全文
148 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
古古 2007-02-07
  • 打赏
  • 举报
回复
哦~~~~非常感谢!!!!
Red_angelX 2007-02-07
  • 打赏
  • 举报
回复
"select * from B_news where B_id=" + Request.QueryString["id"] + "";
改成
"select * from B_news where B_id='" + Request.QueryString["id"] + "'";

16,553

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧