当前位置:网站首页>VB.net程序关闭后后台还在与SQL连接
VB.net程序关闭后后台还在与SQL连接
2022-08-09 05:58:00 【CSDN问答】
这段是批量将Excel数据写入数据库的,但是关闭程序后程序怎么还会在后台运行的?是连接没关闭吗?
For ii = 0 To ListBox1.Items.Count - 1 fileName = ListBox1.Items.Item(ii) Dim ExcelConnection As New System.Data.OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0; Data Source='" & fileName & "'; Extended Properties=""Excel 12.0 Xml; HDR=Yes""") ExcelConnection.Open() Dim expr As String = "SELECT [PASS_ID] FROM [拆分明细$]" Dim objCmdSelect As OleDbCommand = New OleDbCommand(expr, ExcelConnection) Dim objDR As OleDbDataReader Dim SQLconn As New SqlConnection() Dim ConnString As String = "server=localhost;database=STdata;user id=sa;password=Nngs8888!" SQLconn.ConnectionString = ConnString SQLconn.Open() Using bulkCopy As New SqlBulkCopy(SQLconn) bulkCopy.DestinationTableName = "chaifen" Try objDR = objCmdSelect.ExecuteReader bulkCopy.WriteToServer(objDR) SQLconn.Close() Catch ex As Exception MsgBox(ex.ToString) End Try End Using ExcelConnection.Close() ProgressBar1.Value = ii Next边栏推荐
猜你喜欢

VScode安装了ESlint以后不管用、不生效的解决办法

【零基础玩转BLDC系列】无刷直流电机闭环控制与软件架构

中断系统结构及中断控制详解

JMeter test - JMeter 】 【 upload multiple images/batch CSV file upload pictures interface parametric method

进程和计划任务管理

harbor企业级镜像仓库搭建

明明加了唯一索引,为什么还是产生重复数据?

The request was rejected because the URL contained a potentially malicious String “//“

牛客每日刷题之链表

Harbor Enterprise Mirror Warehouse Construction
随机推荐
The difference between LDO and DC-DC
【Wwise】ArgumentException: The specified path is not of a legal form (empty).关于WwiseGlobal中的路径读取错误问题
S7-200SMART PLC Modbus TCP communication
Lock wait timeout exceeded; try restarting transaction 更新数据量范围太大,导致锁表惨案
untiy 倒计时
剑指offer专项突击版第24天
Xilinx Zynq ZynqMP DNA
华为鲲鹏生态培训试题
Functions and differences of command, shell, raw, script modules, application of file, copy, fetch, synchronize
直播电商平台开发,点击查看更多显示所有内容
手把手教你用C语言制作七夕流星雨---优雅永不过时(详细教程)
2022-08-08:给定一个数组arr,表示从早到晚,依次会出现的导弹的高度。 大炮打导弹的时候,如果一旦大炮定了某个高度去打,那么这个大炮每次打的高度都必须下降一点。 1) 如果只有一个大炮,返回
盒子模型中垂直分布的基本内容
Bismuth sulfide nanorods with CT imaging function | Bismuth sulfide-zinc protoporphyrin composites (PAMAM/Bi2S3 composite nanoparticles)
Xray-强大的漏洞扫描工具
【深度学习】聊一聊什么是卷积神经网络,卷积是什么意思?
【mysql数据库】mysql数据库的使用
pytorch implements GAN entry case
feof它可不简单。
八、开发者工具与单元测试