修复8.21问题
This commit is contained in:
+33
-20
@@ -219,11 +219,11 @@
|
||||
" print(f\"清空表时发生错误: {e}\")\n",
|
||||
" if connection.is_connected():\n",
|
||||
" connection.rollback()\n",
|
||||
"finally:\n",
|
||||
" if connection.is_connected():\n",
|
||||
" cursor.close()\n",
|
||||
" connection.close()\n",
|
||||
" print(\"数据库连接已关闭\")\n",
|
||||
"\n",
|
||||
"if connection.is_connected():\n",
|
||||
" cursor.close()\n",
|
||||
" connection.close()\n",
|
||||
" print(\"数据库连接已关闭\")\n",
|
||||
"\n",
|
||||
"\n"
|
||||
],
|
||||
@@ -385,11 +385,11 @@
|
||||
" print(f\"删除数据时发生错误: {e}\")\n",
|
||||
" if connection.is_connected():\n",
|
||||
" connection.rollback()\n",
|
||||
"finally:\n",
|
||||
" if connection.is_connected():\n",
|
||||
" cursor.close()\n",
|
||||
" connection.close()\n",
|
||||
" print(\"数据库连接已关闭\")"
|
||||
"\n",
|
||||
"if connection.is_connected():\n",
|
||||
" cursor.close()\n",
|
||||
" connection.close()\n",
|
||||
" print(\"数据库连接已关闭\")"
|
||||
],
|
||||
"id": "3df14d022c9d8046",
|
||||
"outputs": [
|
||||
@@ -458,11 +458,11 @@
|
||||
" print(f\"删除数据时发生错误: {e}\")\n",
|
||||
" if connection.is_connected():\n",
|
||||
" connection.rollback()\n",
|
||||
"finally:\n",
|
||||
" if connection.is_connected():\n",
|
||||
" cursor.close()\n",
|
||||
" connection.close()\n",
|
||||
" print(\"数据库连接已关闭\")"
|
||||
"\n",
|
||||
"if connection.is_connected():\n",
|
||||
" cursor.close()\n",
|
||||
" connection.close()\n",
|
||||
" print(\"数据库连接已关闭\")"
|
||||
],
|
||||
"id": "fe36740aa6724433"
|
||||
},
|
||||
@@ -473,10 +473,13 @@
|
||||
"id": "76b76aed2ce2a77f"
|
||||
},
|
||||
{
|
||||
"metadata": {},
|
||||
"metadata": {
|
||||
"ExecuteTime": {
|
||||
"end_time": "2025-08-21T02:06:22.956060Z",
|
||||
"start_time": "2025-08-21T02:06:22.797879Z"
|
||||
}
|
||||
},
|
||||
"cell_type": "code",
|
||||
"outputs": [],
|
||||
"execution_count": null,
|
||||
"source": [
|
||||
"import mysql.connector\n",
|
||||
"from mysql.connector import Error\n",
|
||||
@@ -498,7 +501,7 @@
|
||||
"} # 衡时数据库链接配置-mysql\n",
|
||||
"\n",
|
||||
"# 表名\n",
|
||||
"table_name = \"业绩报备表\" # 请替换为实际的表名\n",
|
||||
"table_name = \"test\" # 请替换为实际的表名\n",
|
||||
"\n",
|
||||
"# 连接数据库\n",
|
||||
"connection = mysql.connector.connect(\n",
|
||||
@@ -520,7 +523,17 @@
|
||||
"cursor.close()\n",
|
||||
"connection.close()"
|
||||
],
|
||||
"id": "daf2c94f811fbcdd"
|
||||
"id": "daf2c94f811fbcdd",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"成功删除表 test\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"execution_count": 2
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
|
||||
Reference in New Issue
Block a user