<bdo id='IzADR'></bdo><ul id='IzADR'></ul>
    <i id='IzADR'><tr id='IzADR'><dt id='IzADR'><q id='IzADR'><span id='IzADR'><b id='IzADR'><form id='IzADR'><ins id='IzADR'></ins><ul id='IzADR'></ul><sub id='IzADR'></sub></form><legend id='IzADR'></legend><bdo id='IzADR'><pre id='IzADR'><center id='IzADR'></center></pre></bdo></b><th id='IzADR'></th></span></q></dt></tr></i><div id='IzADR'><tfoot id='IzADR'></tfoot><dl id='IzADR'><fieldset id='IzADR'></fieldset></dl></div>

  • <legend id='IzADR'><style id='IzADR'><dir id='IzADR'><q id='IzADR'></q></dir></style></legend>

      <small id='IzADR'></small><noframes id='IzADR'>

      <tfoot id='IzADR'></tfoot>
      1. Access OLEDB 报告“语法错误";但声明看起来是正确的

        Access OLEDB reports quot;syntax errorquot; but the statement looks correct(Access OLEDB 报告“语法错误;但声明看起来是正确的)

              <tbody id='qOa1r'></tbody>
            <i id='qOa1r'><tr id='qOa1r'><dt id='qOa1r'><q id='qOa1r'><span id='qOa1r'><b id='qOa1r'><form id='qOa1r'><ins id='qOa1r'></ins><ul id='qOa1r'></ul><sub id='qOa1r'></sub></form><legend id='qOa1r'></legend><bdo id='qOa1r'><pre id='qOa1r'><center id='qOa1r'></center></pre></bdo></b><th id='qOa1r'></th></span></q></dt></tr></i><div id='qOa1r'><tfoot id='qOa1r'></tfoot><dl id='qOa1r'><fieldset id='qOa1r'></fieldset></dl></div>
            <tfoot id='qOa1r'></tfoot>

              <small id='qOa1r'></small><noframes id='qOa1r'>

              <legend id='qOa1r'><style id='qOa1r'><dir id='qOa1r'><q id='qOa1r'></q></dir></style></legend>
                <bdo id='qOa1r'></bdo><ul id='qOa1r'></ul>

                • 本文介绍了Access OLEDB 报告“语法错误";但声明看起来是正确的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在 ASP.net 中编写一个简单的页面来更新 Access 表中的密码.以下是有效的 SELECT 查询的语法:

                  I'm writing a simple page in ASP.net to update a password in a Access table. Here's syntax for a SELECT query that works:

                      Dim dbConn As OleDbConnection
                      Dim dbCommand As OleDbCommand
                      Dim dbReader As OleDbDataReader
                  
                      'Connect to db
                      dbConn = New OleDbConnection(Application("strConnectionString"))
                      dbConn.Open()
                  
                      'Get user info
                      strSQL = "SELECT * FROM users WHERE Username = '" & strUsername & "';"
                      dbCommand = New OleDbCommand(strSQL, dbConn)
                      dbReader = dbCommand.ExecuteReader()
                  

                  还有我的连接字符串:

                      Application("strConnectionString") = _
                          "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & strDBPath & _
                              "; Jet OLEDB:Database Password=" & strDBPassword & ";"
                  

                  SELECT 工作正常,所以我知道我的连接正常.但是这个查询给了我一个语法错误:

                  The SELECT works fine, so I know my connection is OK. But this query gives me a syntax error:

                  strSQL = "UPDATE users SET Password = '1'"
                  

                  在其他一切都相同的情况下,ASP 错误表明我的语法有错误.但是当我 response.write strSQL 行时,它给了我这个:

                  With everything else the same, the ASP error says there is an error with my syntax. But when I response.write the strSQL line, it gives me this:

                  UPDATE users SET Password = '1' 
                  

                  当我将其粘贴到 Access 中的查询编辑器中时,查询会将表中的所有密码"字段更新为1",所以我知道语法是可以的.我在没有数据读取器并使用 dbCommand.ExecuteNonQuery() 的情况下进行了尝试,结果相同.

                  and when I paste this into a query editor in Access, the query updates all 'Password' field in the table to '1', so I know the syntax is OK. I tried it without the datareader and using dbCommand.ExecuteNonQuery(), same result.

                  我已经获得了 Access 文件集的权限,因此每个人都可以完全控制,所以我认为这不是权限问题.

                  I've got the permissions on the Access file set so that everybody has full control, so I don't think it's a permission problem.

                  谁能看到我的错误?我真的被困住了.谢谢.

                  Can anybody see my mistake? I'm really stuck. Thanks.

                  推荐答案

                  PASSWORD 是 Access SQL 中的保留字,因此如果它是列名,则需要将其括在方括号中.

                  PASSWORD is a reserved word in Access SQL so you need to enclose it in square brackets if it is a column name.

                  strSQL = "UPDATE users SET [Password] = '1'" 
                  

                  这篇关于Access OLEDB 报告“语法错误";但声明看起来是正确的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Adding headers in ASP.NET MVC 3(在 ASP.NET MVC 3 中添加标头)
                  Response.Redirect strips Header Referrer - Possible to Add it Back?(Response.Redirect 剥离 Header Referrer - 可以将其添加回来吗?)
                  Faking browser request in ASP.net C#(在 ASP.net C# 中伪造浏览器请求)
                  How to delete IIS custom headers like X-Powered-By: ASP.NET from response?(如何从响应中删除 IIS 自定义标头,例如 X-Powered-By: ASP.NET?)
                  What does vary:accept-encoding mean?(变化:接受编码是什么意思?)
                  Cache-control: no-store, must-revalidate not sent to client browser in IIS7 + ASP.NET MVC(缓存控制:在 IIS7 + ASP.NET MVC 中,没有存储、必须重新验证未发送到客户端浏览器)
                  • <legend id='99L4S'><style id='99L4S'><dir id='99L4S'><q id='99L4S'></q></dir></style></legend>

                        <tfoot id='99L4S'></tfoot>
                      • <i id='99L4S'><tr id='99L4S'><dt id='99L4S'><q id='99L4S'><span id='99L4S'><b id='99L4S'><form id='99L4S'><ins id='99L4S'></ins><ul id='99L4S'></ul><sub id='99L4S'></sub></form><legend id='99L4S'></legend><bdo id='99L4S'><pre id='99L4S'><center id='99L4S'></center></pre></bdo></b><th id='99L4S'></th></span></q></dt></tr></i><div id='99L4S'><tfoot id='99L4S'></tfoot><dl id='99L4S'><fieldset id='99L4S'></fieldset></dl></div>
                            <tbody id='99L4S'></tbody>

                          <small id='99L4S'></small><noframes id='99L4S'>

                            <bdo id='99L4S'></bdo><ul id='99L4S'></ul>