Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/83.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 允许在ALTER数据库密码OleDbCommand中使用倒勾(`)_C#_Sql_Oledbcommand - Fatal编程技术网

C# 允许在ALTER数据库密码OleDbCommand中使用倒勾(`)

C# 允许在ALTER数据库密码OleDbCommand中使用倒勾(`),c#,sql,oledbcommand,C#,Sql,Oledbcommand,我正在尝试使用OLEDB命令以编程方式更新.accdb文件密码:ALTER DATABASE PASSWORD[newPasswordWithBacktick][oldPasswordWithBacktick] 如果密码中没有反勾号,我的代码可以工作。使用backticks时,会引发以下异常: 错误(:0)-发生以下错误:IErrorInfo.GetDescription中的Fehler E_失败(0x80004005)。 System.Data.OleDb.OLEDBEException(0x

我正在尝试使用OLEDB命令以编程方式更新.accdb文件密码:
ALTER DATABASE PASSWORD[newPasswordWithBacktick][oldPasswordWithBacktick]

如果密码中没有反勾号,我的代码可以工作。使用backticks时,会引发以下异常:

错误(:0)-发生以下错误:IErrorInfo.GetDescription中的Fehler E_失败(0x80004005)。 System.Data.OleDb.OLEDBEException(0x80004005):IErrorInfo.GetDescription中的Fehler E_失败(0x80004005)。 bei System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr) bei System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams,Object&ExecuteSult) bei System.Data.OleDb.OleDbCommand.ExecuteCommandText(对象和执行结果) bei System.Data.OleDb.OleDbCommand.ExecuteCommand(命令行为、对象和执行结果) bei System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(命令行为,字符串方法) bei System.Data.OleDb.OleDbCommand.ExecuteReader(命令行为) bei System.Data.OleDb.OleDbCommand.ExecuteReader()

当我使用MS Access或Connectionstring打开密码时,允许使用带backtick的相同密码。
是否可以跳过这些反勾号?

停止连接字符串以将数据发送到数据库,改为使用参数。这样,您就不必处理需要重新解析数据的数据库(而且还可以避免SQL注入问题)