保存文件时,我在 VSCode 上的 Prettier Eslint 输出中收到以下错误。
Error: Cannot find module '@typescript-eslint/parser'
Require stack:
- c:\Users\vtnor\.vscode\extensions\rvest.vs-code-prettier-eslint-0.4.1\dist\extension.js
- c:\Program Files\Microsoft VS Code\resources\app\out\vs\loader.js
- c:\Program Files\Microsoft VS Code\resources\app\out\bootstrap-amd.js
- c:\Program Files\Microsoft VS Code\resources\app\out\bootstrap-fork.js
Run Code Online (Sandbox Code Playgroud)
我的包 json 是:
[...]
"typescript": "^4.2.2",
"@typescript-eslint/eslint-plugin": "^4.16.1",
"@typescript-eslint/parser": "^4.16.1",
"eslint": "^7.21.0",
"prettier": "^2.2.1",
"prettier-eslint": "^12.0.0",
[...]
Run Code Online (Sandbox Code Playgroud) typescript eslint visual-studio-code prettier prettier-eslint
我的连接字符串、我的数据库和一切都运行良好,但就在我在我的页面上调用它一次时。
我有几种方法可以连接到我的数据库并向我返回一个值,这是我第一次需要使用其中的两个。我收到此错误conn.Open():
“ConnectionString 属性尚未初始化。” “描述:在执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其在代码中的来源的更多信息。”
异常详细信息:System.InvalidOperationException:ConnectionString 属性尚未初始化。
当我打电话时,只有一个工作得很好。
我的这两种方法的来源是,我对每个人都使用几乎相同的代码,只是更改了表名:
public DataTable Category(){
sda = new SqlDataAdapter("select * from tbl_category", conn);
sda.Fill(dt);
return dt;
}
Run Code Online (Sandbox Code Playgroud)
和
public int CategoryLastId(){
using (conn){
conn.Open();
sqlCommand = new SqlCommand("SELECT MAX(Id) AS LastID FROM tbl_category", conn);
sqlCommand.ExecuteNonQuery();
Int32 newId = (Int32)sqlCommand.ExecuteScalar();
conn.Close();
return Convert.ToInt32(newId);
}
}
Run Code Online (Sandbox Code Playgroud)
感觉他们有冲突(另外,调用 .Get with NHibernate,但这也工作正常)
我有这个查询:
select top 5 * from tbl_post ORDER BY Id DESC
Run Code Online (Sandbox Code Playgroud)
我想选择第 20 行之后的前 5 行。我怎么能做到这一点?