在线急等!关于asp.net中ACCESS数据库from子句语法错误
程序如下publicclassdsclsOledb{privateOleDbConnectionoconn;privateboolconnStatus=false;pub...
程序如下
public class dsclsOledb
{
private OleDbConnection oconn;
private bool connStatus = false;
public dsclsOledb()
{
try
{
oconn = new OleDbConnection();
oconn.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=D:\\我的文档\\Visual Studio 2010\\WebSites\\test1\\Userpass.mdb";
oconn.Open();
connStatus = true;
}
catch
{
connStatus = false;
}
}
public dsclsOledb(string dbName)
{
try
{
oconn = new OleDbConnection();
oconn.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=" + dbName;
oconn.Open();
connStatus = true;
}
catch
{
connStatus = false;
}
}
public bool GetConnStatus
{
get
{
return connStatus;
}
}
//command
public int ModiData(string sql)
{
OleDbCommand cmm = new OleDbCommand(sql, oconn);
return cmm.ExecuteNonQuery();
}
/// <summary>
///
/// </summary>
/// <param name="sql"></param>
/// <returns></returns>
public DataTable GetDt(string sql)
{
//创建一个DataAdapter对象,根据传递过来的sql语句和数据库连接构造对象
OleDbDataAdapter da = new OleDbDataAdapter(sql, oconn);
//创建一个DataTable对象用于接收我们要出来的表
DataTable dt = new DataTable();
//将DataAdapter中的数据填充到DataTable
da.Fill(dt);
return dt;
}
public DataSet GetDs(string sql)
{
OleDbDataAdapter da = new OleDbDataAdapter(sql, oconn);
//创建一个DataTable对象用于接收我们要出来的表
DataSet ds = new DataSet();
//将DataAdapter中的数据填充到DataTable
da.Fill(ds);
return ds;
}
}
public partial class _Default : System.Web.UI.Page
{
dsclsOledb cldb = new dsclsOledb();
protected void Page_Load(object sender, EventArgs e)
{
}
protected void InputEnsure_Click(object sender, EventArgs e)
{
string dsql = "delete from password where Accountplace = '" + InputSelect.Text + "'";
cldb.ModiData(dsql);
}
}
C#编写的! 为什么老是from子句语法错误啊。。 展开
public class dsclsOledb
{
private OleDbConnection oconn;
private bool connStatus = false;
public dsclsOledb()
{
try
{
oconn = new OleDbConnection();
oconn.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=D:\\我的文档\\Visual Studio 2010\\WebSites\\test1\\Userpass.mdb";
oconn.Open();
connStatus = true;
}
catch
{
connStatus = false;
}
}
public dsclsOledb(string dbName)
{
try
{
oconn = new OleDbConnection();
oconn.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=" + dbName;
oconn.Open();
connStatus = true;
}
catch
{
connStatus = false;
}
}
public bool GetConnStatus
{
get
{
return connStatus;
}
}
//command
public int ModiData(string sql)
{
OleDbCommand cmm = new OleDbCommand(sql, oconn);
return cmm.ExecuteNonQuery();
}
/// <summary>
///
/// </summary>
/// <param name="sql"></param>
/// <returns></returns>
public DataTable GetDt(string sql)
{
//创建一个DataAdapter对象,根据传递过来的sql语句和数据库连接构造对象
OleDbDataAdapter da = new OleDbDataAdapter(sql, oconn);
//创建一个DataTable对象用于接收我们要出来的表
DataTable dt = new DataTable();
//将DataAdapter中的数据填充到DataTable
da.Fill(dt);
return dt;
}
public DataSet GetDs(string sql)
{
OleDbDataAdapter da = new OleDbDataAdapter(sql, oconn);
//创建一个DataTable对象用于接收我们要出来的表
DataSet ds = new DataSet();
//将DataAdapter中的数据填充到DataTable
da.Fill(ds);
return ds;
}
}
public partial class _Default : System.Web.UI.Page
{
dsclsOledb cldb = new dsclsOledb();
protected void Page_Load(object sender, EventArgs e)
{
}
protected void InputEnsure_Click(object sender, EventArgs e)
{
string dsql = "delete from password where Accountplace = '" + InputSelect.Text + "'";
cldb.ModiData(dsql);
}
}
C#编写的! 为什么老是from子句语法错误啊。。 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询