错误提示:System.Data.OleDb.OleDbException: FROM ,怎么办?

<%@ Import namespace="System.Data"%>
<%@ Import namespace="System.Data.OleDb"%>
<script language="c#" runat="server">
void Page_Load()
{
string strConnection=" Provider=Microsoft.Jet.OleDb.4.0;";
strConnection +=@"Data Source=E:\zhangtianxing\bianchengleyuan\csharp\image.mdb";
string strSQL="select * from image";
OleDbConnection objConnection=new OleDbConnection(strConnection);
objConnection.Open();
OleDbCommand objCommand=new OleDbCommand(strSQL,objConnection);
zhangtianxing.DataSource=objCommand.ExecuteReader(CommandBehavior.CloseConnection);
zhangtianxing.DataBind();
}
</script>
<body>
<asp:datagrid id="zhangtianxing" runat="server"/>
</body>

错误提示:异常详细信息: System.Data.OleDb.OleDbException: FROM 子句语法错误。
我保证地址啊,字段啊,都没有错?

HUX布斯
浏览 309回答 2
2回答

Cats萌萌

>>string strSQL="select * from image";image是关键字吧,能用吗,你改成[image]试试看呢

慕少森

<asp:datagrid id="zhangtianxing" runat="server"/> 应该在 <FORM>标签里 不然 翻页无效,你为啥把代码写在页面里呢? 这不跟ASP没区别了么?
打开App,查看更多内容
随时随地看视频慕课网APP