f



read from Text file using VB and Insert into SQL table until eof text file reach

Dear All, 

my text file like following, 

a1, b1, c1, d1, e1
a2, b2, c2, d2, e2
a3, b3, c3, d3, e3
a4, b4, c4, d4, e4
.................

and im going to insert this values into SQL Tables with columns, [a, b, c, d,
e]

how im going to do so? i use below src code to do but i can not get the next
line and next line of text file until it finished insert

Private Sub mot_Click()
'Shell ("C:\Program Files\Microsoft Office\Office11\MSACCESS.EXE c:\fisherdb.
mdb /x ImportOpsNilai")

'frmPicCd.Show
Dim db_connect
   ' Path = App.Path & "\ERP consumable code.xls"

     Dim objFSO
         Dim objFile, objTextStream
         Dim strContent
         Const ForReading = 1
         Dim FileName, IEPath, strC1 As String
    FileName = "U:\bureport\buops\RepNilai.txt"
    
         Set objFSO = CreateObject("Scripting.FileSystemObject")
         
         Set objFile = objFSO.GetFile(FileName)
         
         Set objTextStream = objFile.OpenAsTextStream(ForReading,
TristateUseDefault)
                
If objFSO.FileExists(FileName) Then
                
                Set objFile = objFSO.OpenTextFile(FileName, ForReading)
               
'While Not objFile.EOF
                strC1 = objFile.ReadLine
        Dim word
        ReDim word(2)
        word = Split(strC1, ",")
       ' Dim t1, t2, t3 As String
       ' MsgBox RTrim(LTrim(word(44)))
       ' t1 = Replace(word(0), """", "")
       ' t2 = Replace(word(1), """", "")
       Dim sql
        Dim rs As New ADODB.Recordset
        sqldb.Execute ("delete from OPS_Nilai")
        rs.Open ("Select * from OPS_Nilai"), sqldb, adOpenDynamic,
adLockOptimistic
        With rs
        .AddNew
        !Field1 = RTrim(LTrim(word(0)))
        !Field2 = RTrim(LTrim(word(1)))
        !Field3 = RTrim(LTrim(word(2)))
        !Field4 = RTrim(LTrim(word(3)))
        !Field5 = RTrim(LTrim(word(4)))
        !Field6 = RTrim(LTrim(word(5)))
        !Field7 = RTrim(LTrim(word(6)))
        !Field8 = RTrim(LTrim(word(7)))
        !Field9 = RTrim(LTrim(word(8)))
        !Field10 = RTrim(LTrim(word(9)))
        !Field11 = RTrim(LTrim(word(10)))
        !Field12 = RTrim(LTrim(word(11)))
        !Field13 = RTrim(LTrim(word(12)))
        !Field14 = RTrim(LTrim(word(13)))
        !Field15 = RTrim(LTrim(word(14)))
        !Field16 = RTrim(LTrim(word(15)))
        !Field17 = RTrim(LTrim(word(16)))
        !Field18 = RTrim(LTrim(word(17)))
        !Field19 = RTrim(LTrim(word(18)))
        !Field20 = RTrim(LTrim(word(19)))
        
        !Field21 = RTrim(LTrim(word(20)))
        !Field22 = RTrim(LTrim(word(21)))
        !Field23 = RTrim(LTrim(word(22)))
        !Field24 = RTrim(LTrim(word(23)))
        !Field25 = RTrim(LTrim(word(24)))
        !Field26 = RTrim(LTrim(word(25)))
        !Field27 = RTrim(LTrim(word(26)))
        !Field28 = RTrim(LTrim(word(27)))
        !Field29 = RTrim(LTrim(word(28)))
        !Field30 = RTrim(LTrim(word(29)))
        !Field31 = RTrim(LTrim(word(30)))
        !Field32 = RTrim(LTrim(word(31)))
        !Field33 = RTrim(LTrim(word(32)))
        !Field34 = RTrim(LTrim(word(33)))
        !Field35 = RTrim(LTrim(word(34)))
        !Field36 = RTrim(LTrim(word(35)))
        !Field37 = RTrim(LTrim(word(36)))
        !Field38 = RTrim(LTrim(word(37)))
        !Field39 = RTrim(LTrim(word(38)))
        !Field40 = RTrim(LTrim(word(39)))
        
        !Field41 = RTrim(LTrim(word(40)))
        !Field42 = RTrim(LTrim(word(41)))
        !Field43 = RTrim(LTrim(word(42)))
        !Field44 = RTrim(LTrim(word(43)))
        !Field45 = RTrim(LTrim(word(44)))
        .Update
    
        End With
'objFile.SkipLine
'objFile.MoveNext
' Loop
End If

   objTextStream.Close
MsgBox "Update completed!!!", vbOKOnly + vbInformation, "Fisher Nilai"
End Sub

kindly advice


thank you

-- 
Message posted via VBMonster.com
http://www.vbmonster.com/Uwe/Forums.aspx/vbasic/200707/1

-1
carmen413
7/30/2007 1:01:51 PM
comp.lang.visual.basic 2233 articles. 0 followers. please859 (33) is leader. Post Follow

0 Replies
1202 Views

Similar Articles

[PageSpeed] 38

Reply:

Similar Artilces:

Reading Text File, Text Scrolling and erase line from a text file
Hi , How can I Reading Text File, then Text Scrolling by means of keys "page UP" "page Down" and erase a specific line from a text file , when press "F2" key? Best Regards, Lidia from Poland -- ========================================= Pozdrawiam Lidiaa Lidiaa schrieb: > Hi , > > How can I Reading Text File, then Text Scrolling by means of > keys "page UP" "page Down" and erase a specific line from a text > file , when press "F2" key? > > ...

how to read data from text file liine-by-line and insert into table with predefined fields using LABSQL
i have downloaded and installed labSQL; there's an example of of inserting data into a table. How do i configure this vi to insert data directly from a text file into a table? Sample data file   E0070000192AC8FF 00:32:30 E0070000242179B7 00:32:33E007000001BC7E8C 00:32:35E0070000242179B8 00:19:04E0070000192AC8FE 00:32:30 I have no control over the contents(format) of this file , as its been transferred from a linux box via http. Is there a way to read this data line by line and insert into a table , with  each line parsed into 2 fields( TAGID, READ TIME) .so for ...

Read a non text file
How can i convert a weird looking file to text file. I know the main info is stored in the file which looks like below. "����<t���Jч�ĉTV��y�rr��Ph"e~Wm>�E�0Y'p�=C�&�rؙ�<t�Fx�Zo$�+T��=���H Or�r6�S��m&7<�p�q��� u����w}�jlꥎ+_�����Z�?��v��ȉ�XC R�}�_�׍�:�$)�o}��NʨW\&���I@b�#T�B��8���J��CL�ypr\�]R���p\��S�XRҏ�f&?/��� 2�t�_��x���bG���Z�D�v�s [�"��N�# Ѡ�@)�����h'&%�(�)��c�ͼA ���zUZjLRyu�P̤� ��� �W��e�@1'�(��u-nG��p��2_�� T&�6+� _� d�(1Z�E@���h�F�z �~x�fG���s�b�/-+�@��0�%��6�wu�=��z���Y�0...

Reading a text file into a Matlab Matrix
Hello there, I have a text file that contains the following; word11 word12 word13 word14 word21 word22 word23 word24 word31 word32 word33 word34 I want to read it into a 3x4 matrix (each word in a separate cell) I tried to use; data = textread('fileName.txt', '%s', 'delimiter', '\n') - puts each line in one cell data = textread('fileName.txt', '%s', 'delimiter', ' ') - puts each word in one cell but in a 12x1 matrix/array [col1 col2 col3 col4] = textread('tE.txt', '%s %s %s %s', 'delimit...

Visual Basic: Reading Text File Problem
Hi, I'm in need of some ideas or help. Here's what's up. I've got a text file with three columns (separated by commas) with data. eg: ColumnA ColumnB ColumnC 553456 1 7 123456 1 7 123456 1 5 123456 1 2 857456 1 1 I can read this in fine, but what I want to achieve is output this to another text file (instantaneously if possible) like: ColumnA ColumnB ColumnC 553456 1 7 123456 3 14 857456 1 1 so where column A has the same number as the previous or the next...

How to read text file from a website using vb 6 ?
Please help me how to read a text file from a website from internet and display it in a textbox? ???? <bomflash@gmail.com> wrote in message news:1133773298.077512.281850@g47g2000cwa.googlegroups.com... > Please help me how to read a text file from a website from internet and > display it in a textbox? > > ???? > On a form place 1 Inet control, 1 Command button and 1 text box. The Inet control is the "Microsoft Internet Transfer Control" and you access it by checking it's box in Project -> Components. Then it will show as an icon along with the rest o...

loading a table using a text file with insert syntax
I have a text file with INSERT INTO Customers VALUES ( ..... , ...... , etc ) lines and would like to know how do I tell mysql to use this file to load a table which I have created...... don wrote: > I have a text file with INSERT INTO Customers VALUES ( ..... , ...... , > etc ) lines and would like to know how do I tell mysql to use this file to > load a table which I have created...... You can do this with the mysql command-line tool. http://dev.mysql.com/doc/refman/5.0/en/batch-mode.html Regards, Bill K. ...

Reading a text file from VB and save the data to SQL Database
The Script below is working fine. Can anybody convert these script so that it will work from VB Form with a Command Button? Script: Author: Vasu Dim OBJdbConnection Set OBJdbConnection = CreateObject("ADODB.Connection") Set RS = CreateObject ("ADODB.Recordset") Set SQLStmt = CreateObject("ADODB.Command") OBJdbConnection.ConnectionString = "dsn=ScheduleDSN;uid=sa;pwd=;DATABASE=Schedule;APP=ASP Script" OBJdbConnection.Open set rs=createobject("adodb.recordset") RS.open "cds_Cat",OBJdbConnec...

reading from text file to excel file
Hi, I do not know if this is right place for this, but i need some help. I have a text file, whose values are seprated by a delimiter. I want to open this file in excel, ( not import it) . I have written the driver prg in c#. The code opens the file, but it is not writting the values from text file into excel file. I can not figure out the problem here. This is my code: StreamReader dataFileReader =3D null; FileInfo file =3D null; Excel.Application ExcelObj =3D new Excel.Application(); Excel.Workbook workbook =3D null; Excel.Range...

Insert text file in a text field ...
Hallo, I have 2 questions: 1) How can I insert a text file into a TEXT field of a table (by an sql instruction) ? 2) How can I insert a microsoft word file into a BLOB field of a table (by an sql instruction) ? Please, could you help me ? Thank you . Fab. On Thu, 18 Oct 2007 06:41:52 -0700, electric_r@yahoo.it wrote: > Hallo, > > I have 2 questions: > > 1) How can I insert a text file into a TEXT field of a table (by an > sql instruction) ? > > 2) How can I insert a microsoft word file into a BLOB field of a table > (by an sql instruction) ? > > Please, could you help me ? This is a task for the application program, not the database itself. -- A way of life that is odd or even erratic but interferes with no rights or interests of others is not to be condemned because it is different. -- Chief Justice Warren E. Burger electric_r@yahoo.it wrote: > Hallo, > > I have 2 questions: > > 1) How can I insert a text file into a TEXT field of a table (by an > sql instruction) ? > > 2) How can I insert a microsoft word file into a BLOB field of a table > (by an sql instruction) ? > > Please, could you help me ? > > Thank you . > > Fab. Look at the LOAD_FILE() function in the manual On 18 Oct, 14:41, electri...@yahoo.it wrote: > Hallo, > > I have 2 questions: > > 1) How can I insert a text file into a TEXT field of a table (by an > sql instruction) ? > > 2) How can...

concatenating multiple text files into one text file
Hello all, I have a huge number of text files like : spectrum1_300_315.csv spectrum1_315_331.csv spectrum1_331_364.csv spectrum1_364_386.csv spectrum1_386_401.csv ...................................... ....................................... each file contains some headerlines at the beginning and data in 2 columns. I want to concatenate the data of the files into one text file .Can anyone hel me pls?thank u in advance. ...

Converting A Unicode Text File to An ASCII Text File
We have a large number of text files built in Unicode that we need to be read by SAS. SAS does not read Unicode text. To convert the Unicode text to ASCII text we did the following: A Unicode text file adds an additional blank space to each character. To remove this blank character, you can use the code below. The hexidecimal value '00' is a blank character. So remove it using the SAS statement '00'x. The 'x' tells SAS you are reading hexidecimal. Use RECFM=N to tell SAS that you are reading a stream of data that will not conform to a typical file structure. SAS will ...

Importing tab delimited text file data into SQL Server 2000 table via VB
Greetings, I need to create a project in Visual Basic 2003 that imports a text file with tab delimited data (4 columns) into a SQL Server 2000 table. Do you guys know a tutorial or a sample code to accomplish this? I have tons of these text files to import to SQL 2000, so I'm thinking of putting them into a folder and run them all as one batch. Thanks in advance. <ILCSP@NETZERO.NET> wrote in message news:1142613841.234939.159030@u72g2000cwu.googlegroups.com... > Greetings, > > I need to create a project in Visual Basic 2003 that imports a text > file with tab deli...

Insert text file in a text field #3
Hallo, I have 2 questions: with php and mysql : 1) How can I insert a text file into a TEXT field of a table ? 2) How can I insert a microsoft word file into a BLOB field of a table ? Please, could you help me with a simple example ? Thank you . Fab On Thu, 18 Oct 2007 18:36:59 +0200, <electric_r@yahoo.it> wrote: > Hallo, > > I have 2 questions: > > with php and mysql : > > 1) How can I insert a text file into a TEXT field of a table ? > > 2) How can I insert a microsoft word file into a BLOB field of a > table ? > > Please, could you help ...

Insert text file in a text field #2
Hallo, I have 2 questions: with php and mysql : 1) How can I insert a text file into a TEXT field of a table ? 2) How can I insert a microsoft word file into a BLOB field of a table ? Please, could you help me with a simple example ? Thank you . Fab Greetings, electric_r@yahoo.it. In reply to Your message dated Thursday, October 18, 2007, 20:36:14, eyi> Hallo, eyi> I have 2 questions: eyi> with php and mysql : eyi> 1) How can I insert a text file into a TEXT field of a table ? eyi> 2) How can I insert a microsoft word file into a BLOB field of a eyi> table ? eyi> Please, could you help me with a simple example ? This is mostly SQL question. PHP part may looks like: $_field = *_sql_escape_string(file_get_contents('/path/to/document')); *_sql_query("INSERT INTO tablename (fieldname) VALUES ('{$_field}')"); -- Sincerely Yours, AnrDaemon <anrdaemon@freemail.ru> ...

Copy files using filenames from text files
How can I do this???? I have the file "lista.txt", and this file have the next information: one.txt two.txt five.txt six.txt ------------------- This files exist in the same directory that "list.txt", I would like to copy this files to other directory Using Windows the batch file would be like this: for /f "tokens=*" %i in (list.txt) do copy "%i" destdir\ How can I do something like that in UNIX?? Best Regards altariamx2003@gmail.com ha escrito: > How can I do this???? > > I have the file "lista.txt", and th...

Read and display Japanese text from text file
Hi there, a while ago, I posted a question regarding reading japanese text from a text file. Well, since I solved the problem, I thought I'd post my solution for the benefit of other people with the same problem. The plan was to make a script to read and display japanese text. I will use it for making a japanese proverb script and for a japanese language study script. Method : I wrote a simple kanji text file (saved with UTF-8 encoding) I wrote a simple PHP script to display the file contents (saved with UTF-8 encoding) I specified the content-type header for the HTML page : <meta h...

read multiple text files to one file
Hello, I am trying to read multiple text files with different names and write them to a single file. I have several n x 3 text files (n varies across files), and would like to read all these files and combine their columns into one m x 3 text file (m is the number of data points from all the files). Also, how can I perform a paired t-test on specific columns of text files situated in different directories ? Thanks ! On Apr 13, 1:42=A0pm, "Brian " <brianb...@gmail.com> wrote: > Hello, > > I am trying to read multiple text files with different names and w...

read csv file in iframe as text file
Hi, I am trying to load a csv file in Iframe element. I just want to load it as a text file. however when i load the file in iframe it asks to open the file and finally opens it with excel in IE window itself. If i save the save file as .txt it is being read properly.I need to save the file in csv format only so that it can be edited externally with excel easily. Later on i want to display the read csv file in javascript and do some processing on it. Does any know how do this. The basic problem is to stop IE from invoking excel to open csv file and instead read the file as text. Following code works for .txt file <iframe name="loader" id="frm" width="1000" height="300" style="visibility:hidden;display:none" src="Book1.txt"></iframe> and when i use this line it tries to open the file using excel which i don't want. <iframe name="loader" id="frm" width="1000" height="300" style="visibility:hidden;display:none" src="Book1.csv"></iframe> Any suggestions? Thanks Sukhmeet sukhm...@gmail.com wrote: > =A0 I am trying to load a csv file in Iframe element. I just want to > load it as a text file. > however when i load the file in iframe it asks to open the file and > finally opens it with excel in IE window itself. If i save the save > file as .txt it is being read properly.I need to save the file in csv > fo...

reading file list, writing to text file
Hi. I'm relatively new to matlab and would like to read all the jpg in a directory (for later manipulation) and create a text file with a list of all the files read (with directory path). Currently i have: d=dir('*.jpg'); for k=1:length(d) fname=d(k).name; fname %check it is reading all files fid=fopen('list.txt', 'w'); count = fprintf(fid, fname); fclose(fid) end The problem I have is that even though the program correctly reads through all the files, only the last read file is stored in the text file....I presume the text file is just constantly being...

How to format a text file just like the RFC-text files?
I want to make some document go like these, what tools can help? Any help would be nice, thanks! BLIOGRAPHY ........................................... 34 APPENDIX A. EXAMPLES ............................................... 36 B. SIMPLE FIELD PARSING ................................... 40 C. DIFFERENCES FROM RFC #733 .............................. 41 D. ALPHABETICAL LISTING OF SYNTAX RULES ................... 44 August 13, 1982 - i - RFC #822 ^L Standard for ARPA Internet Text Messages PREFACE By 1977, the Arpanet employed several informal standards for the text messages (mail) sent among its host computers. It was felt necessary to codify these practices and provide for those features that seemed imminent. The result of that effort was Request for Comments (RFC) #733, "Standard for the Format of ARPA Network Text Message", by Crocker, Vittal, Pogran, and Henderson. The specification attempted to avoid major changes in existing software, while permitting several new features. The framework severely constrains document tone and appear- ance and is primarily useful for most intra-organization communi- cations and well-structured inter-organization communication. It also can be used for some types of inter-process commun...

Advantages of Binary Files over Text files in Search and read
Dear all, What are the advantages of binary files over text files? I would like to search for a specific value of a variable in an output file, I was doing this lately by the string library functions of the language. But wondering the advantages of searching and reading from a binary file. If the files get too large, I guess the advantage of reading from a binary file is that it is much faster. Regards, "utab" <umut.tabak@gmail.com> wrote: > What are the advantages of binary files over text files? I would like > to search for a specific value of a variable in an outp...

Size of SAS file after reading from a raw text file
Hi, I have a text file of size close to 1.7 GB. it has five fields in it and 20373376 records. Im reading ALL of this data in to SAS using input statement and see that the final SAS file is just 473 MB. I have checked the number of observations in SAS and it is equal to the flat file and have also printed out some data and they seem to be fine. I expected SAS file to be bigger? (I have 3 other files having same kind of fields etc and for those the SAS data set is anywhere from 10% to 300% more than corresponding raw data) hp Depends on the data. By default, a numeric value takes eight...

read text file through Labview and then write to an excel file
Hello, &nbsp; I am relatively new with using Labview. I was wondering what would be a general method of reading data from a text file (words, sentences, numbers, and etc.) and making Labview write it on an Excel file. &nbsp; Thanks Ivan ...

Web resources about - read from Text file using VB and Insert into SQL table until eof text file reach - comp.lang.visual.basic

Insert key - Wikipedia, the free encyclopedia
The Insert key (often abbreviated INS ) is a key commonly found on computer keyboards . It is primarily used to switch between the two text-entering ...

Inserts Wallpapers & Photos on the App Store on iTunes
Get Inserts Wallpapers & Photos on the App Store. See screenshots and ratings, and read customer reviews.

hud-dot-epa south lincoln insert - Flickr - Photo Sharing!
www.sustainablecommunities.gov/pdf/partnership_accomplish...

Lumia 640 XL - How to insert SIM and memory card - YouTube
Learn how to get started with your Lumia 640 XL or Lumia 640 XL Dual SIM. In this video you'll learn how to insert the SIM cards and the memory ...

Top five 'have you seen my (insert body part?)' films
Some flicks are downright prophetic about the need for prosthesis. Seek these films out and ye shall gain from others' anatomic loss. -

Dear [insert name], Qantas takes your complaint very seriously, honest
What's more annoying than being delayed nine hours on a long-haul flight between Sydney and Los Angeles, while stuck in a seat with a broken ...

Skype to insert advertising into calls
Skype to insert advertising into calls

ISIS inserts disturbing images into N.L. vote Twitter chatter
Note: The CBC does not necessarily endorse any of the views posted. By submitting your comments, you acknowledge that CBC has the right to reproduce, ...

Samsung Galaxy Note 5 now ships with warning not to insert S-Pen the wrong way
... YouTube unboxing video reveals that Samsung has begun shipping its Galaxy Note 5 handsets with a warning label, telling users not to insert ...

Updates to Google Docs & Slides let you insert & quickly edit images on iOS
Google is today rolling out updates to its Google Docs and Slides mobile apps bringing the ability to insert images directly from the app on ...

Resources last updated: 3/10/2016 6:43:46 AM