悬赏园豆:50
[已解决问题]
解决于 2008-03-27 23:04
public DataRow dr;<BR> public static string newsid;
<P> protected void Page_Load(object sender, EventArgs e)<BR> {<BR> newsid = Request.Params["nid"];<BR> SqlConnection con = DB.con();<BR> SqlDataAdapter dad4 = new SqlDataAdapter("select * from news where nid="+newsid,con);<BR> DataSet dst = new DataSet();<BR> dad4.Fill(dst, "aaa");<BR> dr = dst.Tables["aaa"].Rows[0];<BR> }</P>
<P><STRONG>常详细信息: </STRONG><FONT face=Arial>System.Data.SqlClient.SqlException: 第 1 行: '=' 附近有语法错误。<BR><BR></FONT><B>源错误:</B><FONT face=Arial> <BR><BR></FONT>
<TABLE width="100%" bgColor=#ffffcc>
<TBODY>
<TR>
<TD><CODE><PRE>行 22: SqlDataAdapter dad4 = new SqlDataAdapter("select * from news where nid="+newsid,con);
行 23: DataSet dst = new DataSet();
<FONT color=red>行 24: dad4.Fill(dst, "aaa");
</FONT>行 25: dr = dst.Tables["aaa"].Rows[0];
行 26: </PRE></CODE></TD></TR></TBODY></TABLE></P>
问题补充:
调试了一下,竟然newsid的值为null,请问出现为空值,一般在什么情况下?