用VB将TXT文本中的内容导入oracle数据库.......急!!急

   更新日期:2024.06.01
Private Sub Form_Load()
Dim strfilename As String ''文本文件路径
Dim strtext As String
Dim array1 As Variant ''数组
Dim i As Integer
dim strsql as string ''sql 语句
Dim strno As String ''信息序号部分
Dim strcontent As String ''信息内容部分

strfilename = "d:\1.txt"
Open strfilename For Binary As #1
strtext = Input(LOF(1), #1) ''将文本内容赋给strtext
Close #1

array1 = Trim(Split(strtext, ","))
For i = LBound(array1) To UBound(array1)
strno = Mid(array1(i), 1, 1) ''取序号
strcontent = Mid(Array(i), 3, 5) ''取信息
''下面为插入数据库,假设cnn为数据库连接
strsql="insert into info(序号,信息) values('" & strno & "','" & strcontent & "')"
cnn.excute strsql
Next
End Sub

  • 15698804653 :VB.NET中怎么导入TXT文本里的数据
    蔺贫庙1292 :答:比如说用Richtext控件 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim file As String = "f:/x.txt"RichTextBox1.LoadFile(file)MsgBox("ok")End Sub
  • 15698804653 :vb中如何在一个文本框中导入TXT格式的文本~我要自己选择路径的~~
    蔺贫庙1292 :答:'将文件内容显示在文本框 Text1.Text = MyStr '>>> Exit Sub ErrHandler:'用户在通用对话框里按了"取消"按钮。Exit Sub End Sub Private Sub Command2_Click()End End Sub
  • 15698804653 :用vb在 txt文本里检索相应的行再将内容复制到text文本框
    蔺贫庙1292 :答:Private Sub Form_Load()Dim myline As String, k1g As Boolean, k2g As Boolean Open App.Path & "\list.txt" For Input As #1 Do While Not EOF(1)Line Input #1, myline If k2g = True Then List1.AddItem myline k2g = False End If If myline = "*" And k1g = False Then...
  • 15698804653 :VB,怎么把一个文本文件aaa.txt中所有的内容读到文本框中,请写出详细的...
    蔺贫庙1292 :答:public function loadtext(madd as string) as string dim strA as string dim strB as string open madd for input as #1 while Eof(1)Get #1,,strA strB=strB & starA wend loadtext=strB end function 在程序中调用此函数即可,如:text1.text=loadtext("c:\aaa.txt")...
  • 15698804653 :请教在VB.net中如何将数据写入txt文件、再从txt文件读出?
    蔺贫庙1292 :答:软糖来告诉你吧。VB.net中读写文件主要使用System.IO命名空间。① 使用 File.ReadAllText 读取 Dim s As String = System.IO.File.ReadAllText("C:\a.txt")② 使用 StreamReader 读取,注意编码格式和写入的编码保持一致。Dim sr As StreamReader = New StreamReader("C:\a.txt", System.Text....
  • 15698804653 :VB达人请进,关于VB引入TXT文件的问题
    蔺贫庙1292 :答:下面的代码把文本框Text1中的内容写到一个顺序文件:Exercise.TXT,存放于D:\:Open "D:\Exercise.TXT" For Output As #2 Print #2, Exercise.Text Close #2 2、 Write # 语句:将记录写入文件 语法格式为:Write # 文件号[,表达式列表]该语句适用于向划分了字段的记录格式的文件写入数据。“...
  • 15698804653 :vb怎么导入txt文本
    蔺贫庙1292 :答:Private Sub Command1_Click()CommonDialog1.FileName = ""CommonDialog1.Filter = "文本文件|*.txt"CommonDialog1.ShowOpen If CommonDialog1.FileName = "" Then Exit Sub Dim MyString As String Open CommonDialog1.FileName For Input As #1 Do While Not EOF(1)DoEvents Line Input #1,...
  • 15698804653 :用VB如何读取txt的数据到text控件中?
    蔺贫庙1292 :答:Dim s As String, i As Integer Open "1.txt" For Input As #1 For i = Text1.lbound To Text1.ubound If EOF(1) Then Exit For Line Input #1, s Text1(i).Text = s Next Close #1
  • 15698804653 :vb 读取txt指定内容并写到另一个txt
    蔺贫庙1292 :答:Private Sub Command1_Click()Open App.Path & "\1.txt" For Input As #1 Open App.Path & "\2.txt" For Output As #2'如果要追加,将Output修改为Append Do While Not EOF(1)Line Input #1, s If Val(s) Mod 3 = 2 Then Print #2, s Loop Close #1 Close #2 End Sub ...
  • 15698804653 :VB如何读取TXT文件里面的内容到文本框
    蔺贫庙1292 :答:Private Sub Form_click()Dim a Open "c:\1.txt" For Input As #1 Do Input #1, a Text1.Text = Text1.Text & a & vbCrLf Loop Until EOF(1)Close #1 End Sub 貌似1楼的只能读取1行而已。。
  • 相关链接

    欢迎反馈与建议,请联系电邮
    2024 © 视觉网