这行代码SqlDataReader dr = cmd.ExecuteReader();有什么语法错误?总报错说等号附近有语法错误
全部代码为:usingSystem;usingSystem.Data;usingSystem.Data.SqlClient;usingSystem.Configurati...
全部代码为: using System; using System.Data; using System.Data.SqlClient; 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; public partial class Default6 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { SqlConnection conn = new SqlConnection("server=localhost;database=bookshop;uid=sa;pwd=;"); SqlCommand cmd = new SqlCommand("select image,image_size from images where id=" + Request["id"], conn); conn.Open(); SqlDataReader dr = cmd.ExecuteReader(); if (dr.Read()) { Response.BinaryWrite((byte[])dr["image"]); } dr.Close(); conn.Close(); Response.End(); } }
展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询