Ok so I am taking jm advice and using TextField Parser instead of ADO.net to read my delimited files and then build my own datatables
First question is how would I query the data?
I need to be able to have two tables, one with sold propertys and one with propertys still for sale.
The table I created thus far has all the records, the problem and my second question is how do you allow for a null value ?
If one of the records isnt Sold then it won't have a Selling Price therefore when I set my datacolumn to be of System.Integer type It is not accepted
Here is what I have so far:
The datagridviews are only for me to see my resultsHTML Code:Private Sub FileToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FileToolStripMenuItem.Click Dim openFileDialog1 As New OpenFileDialog If openFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then Using myReader As New Microsoft.VisualBasic.FileIO.TextFieldParser(openFileDialog1.FileName) myReader.SetDelimiters(",") Dim currentRow As String() Dim currentField As String Dim i As Integer = -1 currentRow = myReader.ReadFields() For Each currentField In currentRow i += 1 DataGridView1.Columns.Add("Field", currentRow(i)) Next Dim table As New DataTable With table.Columns .Add("StreetNumber", System.Type.GetType("System.String")) .Add("StreetName", System.Type.GetType("System.String")) .Add("Unit Number", System.Type.GetType("System.String")) .Add("City", System.Type.GetType("System.String")) .Add("State", System.Type.GetType("System.String")) .Add("ZipCode", System.Type.GetType("System.String")) .Add("MLS Number", System.Type.GetType("System.String")) .Add("OriginalListPrice", System.Type.GetType("System.String")) .Add("CurrentListPrice", System.Type.GetType("System.String")) .Add("ListingDate", System.Type.GetType("System.DateTime")) .Add("DayOnMarket", System.Type.GetType("System.Double")) .Add("Status", System.Type.GetType("System.String")) .Add("Style", System.Type.GetType("System.String")) .Add("Bedrooms", System.Type.GetType("System.String")) .Add("Baths", System.Type.GetType("System.String")) .Add("SqFt", System.Type.GetType("System.String")) .Add("GarageSpaces", System.Type.GetType("System.String")) .Add("Fireplace", System.Type.GetType("System.String")) .Add("Pool", System.Type.GetType("System.String")) .Add("View", System.Type.GetType("System.String")) .Add("LotSize", System.Type.GetType("System.String")) .Add("YearBuilt", System.Type.GetType("System.String")) .Add("Levels", System.Type.GetType("System.String")) .Add("Attached", System.Type.GetType("System.String")) .Add("SaleType", System.Type.GetType("System.String")) .Add("Longitude", System.Type.GetType("System.String")) .Add("Latitude", System.Type.GetType("System.String")) .Add("HOAFees", System.Type.GetType("System.String")) .Add("AgentRemarks", System.Type.GetType("System.String")) .Add("PropertyDescription", System.Type.GetType("System.String")) .Add("DateSold", System.Type.GetType("System.String")) .Add("SellingPrice", System.Type.GetType("System.String")) DataGridView2.DataSource = table End With While Not myReader.EndOfData Try currentRow = myReader.ReadFields() DataGridView1.Rows.Add(currentRow) table.Rows.Add(currentRow) For Each currentField In currentRow Next Catch ex As Microsoft.VisualBasic.FileIO.MalformedLineException MsgBox("Line " & ex.Message & _ "is not valid and will be skipped.") End Try End While End Using Else 'The user closed the dialog without choosing a file End If End Sub




Reply With Quote