当前位置: 代码迷 >> Sql Server >> SqlHelper 有关问题
  详细解决方案

SqlHelper 有关问题

热度:460   发布时间:2016-04-27 14:32:12.0
SqlHelper 问题
if (type == "jpg" || type == "gif" || type == "bmp" || type == "png")
  {
  //打开连接对象
  S601_myConn.Open();
  FileUpload1.SaveAs(ipath);//服务器保存路径
  SqlHelper.ExecuteNonQuery(S601_sql);

  S601_myConn.Close();
  }
  string query2 = "select * from Image where iid=" + Convert.ToInt32(TextBox1.Text);
  //创建数据源执行命令
  SqlCommand cmd = new SqlCommand(query2, S601_myConn);
  SqlDataReader sdr = string query2 = "select * from Image where iid=" + Convert.ToInt32(TextBox1.Text);
  SqlDataReader sdr = SqlHelper.ExecuteReader(query2);
我在做把图片依路径形式存到数据库,在使用SqlHelper时提示不包含ExecuteReader,ExecuteNonQuery,但是我已经有了SqlHelper.cs,内容如下:using System;
using System.Data;
using System.Configuration;
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;

/// <summary>
/// SqlHelper 的摘要说明
/// </summary>
public class SqlHelper
{
  public SqlHelper()
  { }
}

------解决方案--------------------
不包括就是没有实现,你自己写实现方法吧
------解决方案--------------------
探讨
SqlDataReader sdr = string query2 = "select * from Image where iid=" + Convert.ToInt32(TextBox1.Text);

------解决方案--------------------
string query2 = "select * from [Image] where iid=" + Convert.ToInt32(TextBox1.Text); IMAGE是关键字吧
------解决方案--------------------
看不懂