当前位置:网站首页>After the VB.net program is closed, the background is still connected to SQL
After the VB.net program is closed, the background is still connected to SQL
2022-08-09 06:02:00 【CSDN Q&A】
This section writes Excel data into the database in batches, but how can the program still run in the background after closing the program?Is the connection not closed?
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.0Xml; HDR=Yes""") ExcelConnection.Open() Dim expr As String = "SELECT [PASS_ID] FROM [split details$]" 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
边栏推荐
- [mysql database] the use of mysql database
- 一天学习一家上市公司:索菲亚
- 直播平台怎么搭建,设置状态栏颜色、沉浸式状态栏
- [R language] Extract all files under a folder to a specific folder
- Fe3O4/SiO2 Composite Magnetic Nanoparticles Aminated on SiO2-NH2/Fe3O4 Surface (Qiyue Reagent)
- command,shell,raw,script模块的作用和区别,file、copy、fetch、synchronize的应用
- Molybdenum disulfide/hafnium dioxide composite nanomaterials (MoS2/HfO2) | tantalum-doped hafnium dioxide nanoparticles (Qi Yue bio)
- S7-200SMART PLC Modbus TCP communication
- Word文件的只读模式没有密码怎么退出?
- RNN-T
猜你喜欢
[email protected]@cadmium sulfide nanocore-shell structure material|Fe3O4 magnetic nanop"/>
Superparamagnetic iron [email protected]@cadmium sulfide nanocore-shell structure material|Fe3O4 magnetic nanop
Introduction to AIOT
Three Musketeers Advanced
契约测试(上):什么是契约测试
JVM:(七)运行时数据区之堆
A day to learn a public company: Sophia
#define
三剑客进阶
phpstudy 安装 flarum论坛
SiO2 / KH550 modified ferroferric oxide nano magnetic particles | PDA package the ferromagnetic oxide nanoparticles (research)
随机推荐
Regular Expression - Determine if a string matches the "AABB" pattern
Distributed timing task framework xxl-job source code analysis
二十四节气之立秋
Used to import the data type
redis 运行lua 脚本 出现Invalid argument(s)
Invalid argument(s) appears when redis runs lua script
Unity Gobang Game Design and Simple AI (2)
【mysql数据库】mysql数据库的使用
Likou Brush Question 180
JVM:(七)运行时数据区之堆
Can Jincang Database Set Transaction Automatic Commit?
MYSQLg高级------批量插入百万级数据量
Getting Started with MATLAB Image Processing
Data center project preliminary summary
pytorch implements GAN entry case
【R语言】对文件进行归一化整理到各文件类型文件夹
文本字符串长度排序 - 在线工具
sqlserver导入数据类型问题
手把手教你用C语言制作七夕流星雨---优雅永不过时(详细教程)
[Deep Learning] Let's talk about what is convolutional neural network and what does convolution mean?