|
-
Jul 25th, 2012, 11:18 AM
#1
Thread Starter
Junior Member
skipping line 2 when uploaded
hey having this problem and cant figure it out. This is my code:
Code:
Dim InstitutionFileReader As New System.IO.StreamReader("C:\Documents and Settings\CSchexnaydre\Desktop\TEST SHEETS\Institution\HD2010.csv")
InstitutionFileReader.ReadLine()
Dim i As Integer
INSERT_INST_COMMAND = WFSDSTRING.CreateCommand()
'Enable double quotes as string delimiters on the SQL Server
INSERT_INST_COMMAND.CommandText = "SET QUOTED_IDENTIFIER OFF"
INSERT_INST_COMMAND.ExecuteNonQuery()
'Get rid of header line
InstitutionFileReader.ReadLine()
While Not InstitutionFileReader.EndOfStream
INSERT_INST_COMMAND.CommandText = "INSERT INTO Institution_UPLOAD (Institution_ID, Institution_Name, Address_1, City, State_Code, Zip, FIPS, OBE_Region_ID, Chief_Admin_Name_ID, Chief_Admin_Title_ID, Institution_Phone, ENI, OPE_Number, OPEFLAG_ID, Institution_Web, Admission_Web, Financial_Web, Application_Web, SECTOR, Type_Of_Institution_ID, Level_Of_Institution_ID, HLOFFER_ID, UGOFFER_ID, GROFFER_ID, HDEGOFR1_ID, DEGGRANT_ID, Historic_Black_College_ID, Hospital_Available_ID, Medical_Degree_ID, Tribal_College_ID, Location_ID, Open_To_Public, ACT_ID, New_ID, Deleted_Year, Closed_Date, CYACTIVE_ID, POSTEC_ID, PSEFLAG_ID, PSET4FLG_ID, RPTMTH_ID, ALIAS, INSTCAT_ID, CCBASIC_ID, CCIPUG_ID, CCIPGRAD_ID, CCUGPROF_ID, CCENPRF_ID, CCSIZSET_ID, CARNEGIE_ID, TENURSYS_ID, Land_Grant_Institution_ID, Size_Of_Institution_ID, CBSA_ID, CBSATYPE_ID, CSA_ID, NECTA_ID, F1SYSTYP_ID, F1SYSNAM, Institution_Fax) " & _
"VALUES (" & InstitutionFileReader.ReadLine() & ")"
i = INSERT_INST_COMMAND.ExecuteNonQuery()
End While
InstitutionFileReader.Close()
InstitutionFileReader = Nothing
End If
it works fine but the only problem i am having with it is that its skipping line 2 which includes a row of data that needs to be uploaded to the database.
Example of .csv file:
Column1, Column2, Column3
Value1, Value2, Value3 <<<<<<<< Skipping this one
Value1, Value2, Value3
Value1, Value2, Value3
Value1, Value2, Value3
-
Jul 25th, 2012, 11:44 AM
#2
Re: skipping line 2 when uploaded
vb Code:
Dim InstitutionFileReader As New System.IO.StreamReader("C:\Documents and Settings\CSchexnaydre\Desktop\TEST SHEETS\Institution\HD2010.csv")
InstitutionFileReader.ReadLine() 'doesn't this get rid of header line?
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Jul 25th, 2012, 11:46 AM
#3
Re: skipping line 2 when uploaded
VB Code:
Dim InstitutionFileReader As New System.IO.StreamReader("C:\Documents and Settings\CSchexnaydre\Desktop\TEST SHEETS\Institution\HD2010.csv")
InstitutionFileReader.ReadLine() 'Reads header line
Dim i As Integer
INSERT_INST_COMMAND = WFSDSTRING.CreateCommand()
INSERT_INST_COMMAND.CommandText = "SET QUOTED_IDENTIFIER OFF"
INSERT_INST_COMMAND.ExecuteNonQuery()
InstitutionFileReader.ReadLine() 'reads first line of data
While Not InstitutionFileReader.EndOfStream
INSERT_INST_COMMAND.CommandText = "INSERT INTO Institution_UPLOAD (Institution_ID, Institution_Name, Address_1, City, State_Code, Zip, FIPS, OBE_Region_ID, Chief_Admin_Name_ID, Chief_Admin_Title_ID, Institution_Phone, ENI, OPE_Number, OPEFLAG_ID, Institution_Web, Admission_Web, Financial_Web, Application_Web, SECTOR, Type_Of_Institution_ID, Level_Of_Institution_ID, HLOFFER_ID, UGOFFER_ID, GROFFER_ID, HDEGOFR1_ID, DEGGRANT_ID, Historic_Black_College_ID, Hospital_Available_ID, Medical_Degree_ID, Tribal_College_ID, Location_ID, Open_To_Public, ACT_ID, New_ID, Deleted_Year, Closed_Date, CYACTIVE_ID, POSTEC_ID, PSEFLAG_ID, PSET4FLG_ID, RPTMTH_ID, ALIAS, INSTCAT_ID, CCBASIC_ID, CCIPUG_ID, CCIPGRAD_ID, CCUGPROF_ID, CCENPRF_ID, CCSIZSET_ID, CARNEGIE_ID, TENURSYS_ID, Land_Grant_Institution_ID, Size_Of_Institution_ID, CBSA_ID, CBSATYPE_ID, CSA_ID, NECTA_ID, F1SYSTYP_ID, F1SYSNAM, Institution_Fax) " & _
"VALUES (" & InstitutionFileReader.ReadLine() & ")" 'reads 2nd & subsequent lines of data
i = INSERT_INST_COMMAND.ExecuteNonQuery()
End While
InstitutionFileReader.Close()
InstitutionFileReader = Nothing
End If
-
Jul 25th, 2012, 01:12 PM
#4
Thread Starter
Junior Member
Re: skipping line 2 when uploaded
 Originally Posted by .paul.
vb Code:
Dim InstitutionFileReader As New System.IO.StreamReader("C:\Documents and Settings\CSchexnaydre\Desktop\TEST SHEETS\Institution\HD2010.csv")
InstitutionFileReader.ReadLine() 'doesn't this get rid of header line?
dang thankz .paul. for the second time today lmao u right i had it twice lol
thankz again
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|