在asp.net中使用VB.net(将文本文件中的数据导入到SQL中)plz ... [英] In asp.net useing VB.net (import data from text file in to SQL) plz ...
本文介绍了在asp.net中使用VB.net(将文本文件中的数据导入到SQL中)plz ...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何浏览asp.net页中的文件并将数据从文本文件导入到我的sql数据库?
我在sql中使用表调用测试,并使用employee.txt文件
我需要帮助,请
谢谢alot
how i can browse files in my asp.net page and import the data from text file to my sql database?
i use table call test in sql and i use employs.txt file
i need help plz
thanks alot
推荐答案
使用此功能读取txt文件.并使用您的逻辑来保存txtfile数据以保存
use this function for reading txt file. and use your logic to save txtfile data to save
Public Sub getdataFromTxtFile(ByVal FilePath As String)
Dim r As System.IO.StreamReader = System.IO.File.OpenText(FilePath)
Dim inputString As String
inputString = ""
Dim line As String
Do
line = r.ReadLine()
If line IsNot Nothing Then
inputString = inputString + line
' you can save this line in database or whole
' file data which are coming in inputString variable
End If
Loop While line IsNot Nothing
End Sub
这篇关于在asp.net中使用VB.net(将文本文件中的数据导入到SQL中)plz ...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文