无法将类型“System.Data.SqlClient.SqlCommand”隐式转换为“string”
以下是一个公共类的代码:
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;
using System.Data.SqlClient;
/// <summary>
/// Sqldata 的摘要说明
/// </summary>
public class Sqldata
{
private SqlConnection sqlcon;
private SqlCommand sqlcom;
private SqlDataAdapter sqldata;
#region
public Sqldata()
{
//
// TODO: 在此处添加构造函数逻辑
//
sqlcon=new SqlConnection(ConfigurationManager.AppSettings[ "constr "]);
sqlcon.Open();
}
#endregion
#region
public bool ExecSql(string SqlCom)
{
sqlcom = new SqlCommand(SqlCom, sqlcon);
try
{
sqlcom.ExecuteNonQuery();
return true;
}
catch
{
return false;
}
finally
{
sqlcon.Close();
}
}
#endregion
public DataSet ExecDS(string sqlcom)
{
try
{
sqlcom = new SqlCommand(sqlcom, sqlcon);
sqldata = new SqlDataAdapter();
sqldata.SelectCommand = sqlcom;
DataSet ds = new DataSet();
&nb