主题:在关键字 'from' 附近有语法错误。
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>
/// DB 的摘要说明
/// </summary>
public class DB
{
SqlConnection con = null ;
SqlCommand cmd = new SqlCommand();
public DB()
{
con = new SqlConnection("server=.;database=vote;uid=sa;pwd=123;");
}
public SqlConnection getCon()
{
if(con.State == ConnectionState.Closed)
con.Open();
return con;
}
public string executeGetReturn(string strSql)
{
//getCon();
cmd.Connection = getCon();
cmd.CommandText = strSql;
string result = cmd.ExecuteScalar().ToString();
return result;
}
}
[em10]
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>
/// DB 的摘要说明
/// </summary>
public class DB
{
SqlConnection con = null ;
SqlCommand cmd = new SqlCommand();
public DB()
{
con = new SqlConnection("server=.;database=vote;uid=sa;pwd=123;");
}
public SqlConnection getCon()
{
if(con.State == ConnectionState.Closed)
con.Open();
return con;
}
public string executeGetReturn(string strSql)
{
//getCon();
cmd.Connection = getCon();
cmd.CommandText = strSql;
string result = cmd.ExecuteScalar().ToString();
return result;
}
}
[em10]