主题:FROM 子句语法错误。
index.aspx.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;
using System.Data.OleDb;
public partial class _Default : System.Web.UI.Page
{
private void Page_Load(object sender, EventArgs e)
{
String strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= D:\\WebSite1\\data\\data.mdb";
OleDbConnection objConnection = new OleDbConnection(strConnection);
String strSql = "select * from user";
OleDbCommand objCommand = new OleDbCommand(strSql,objConnection);
objConnection.Open();
OleDbDataReader dr = objCommand.ExecuteReader();
aa.DataSource = dr;
aa.DataBind();
objConnection.Close();
}
}
要是报错:FROM 子句语法错误。
我把"select * from user";改成"select * from 'user'";
报错:查询语法错误。查询子句不完整。
本人是新手,帮忙解答一下,万分感谢!
也欢迎初学者加我qq:573042439一起研究
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.OleDb;
public partial class _Default : System.Web.UI.Page
{
private void Page_Load(object sender, EventArgs e)
{
String strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= D:\\WebSite1\\data\\data.mdb";
OleDbConnection objConnection = new OleDbConnection(strConnection);
String strSql = "select * from user";
OleDbCommand objCommand = new OleDbCommand(strSql,objConnection);
objConnection.Open();
OleDbDataReader dr = objCommand.ExecuteReader();
aa.DataSource = dr;
aa.DataBind();
objConnection.Close();
}
}
要是报错:FROM 子句语法错误。
我把"select * from user";改成"select * from 'user'";
报错:查询语法错误。查询子句不完整。
本人是新手,帮忙解答一下,万分感谢!
也欢迎初学者加我qq:573042439一起研究