using System; using System.Data; using System.Data.OleDb; using System.Data.SqlClient; 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; public partial class _Default : System.Web.UI.Page { protected void page_load(object sender, EventArgs e) { OleDbConnection oledbconnection; string oledbconnstr; oledbconnstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Server.MapPath("App_Data/database.mdb"); oledbconnection=new OleDbConnection(oledbconnstr); oledbconnection.Open(); if(Page.IsPostBack) { OleDbCommand oledbcommand; OleDbDataReader oledbdatareader; string sqlstr; sqlstr="select * from user where uid='"+uid.Text+"'"; oledbcommand=new OleDbCommand(sqlstr,oledbconnection); oledbdatareader=oledbcommand.ExecuteReader(); if(oledbdatareader.HasRows) { if(oledbdatareader.Read()) { if (pwd.Text==oledbdatareader["pwd"]) { Response.Write("<script>alert('登陆成功!!!');</" + "script>"); } else { Response.Write("<script>alert('用户不存在!!!');</" + "script>"); } } } oledbcommand=null; oledbconnection.Close(); oledbconnection=null; } } 以上代码是显示oledbdatareader=oledbcommand.ExecuteReader(); System.Data.OleDb.OleDbException: FROM 子句语法错误 是怎么回事,以前别的网页都是这样作的没错啊,
关于 数据库表名为关键字 如 user。。
最新推荐文章于 2023-06-17 09:38:18 发布