473,473 Members | 2,060 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Funny character in first cell of datagrid

Hi,

I'm trying to upload a CSV file into a dataset and then trying to
display the dataset using a datagrid.

However, I can only seem to read the first element in the CSV file and
it is being display with a funny 'yp' character.
Here's the code if anyone can spot the problem ... thanx in
advance!!~!
Dim strConnectionString As String
Dim strPathToTextFile As String

Dim tempString As String

strPathToTextFile = Server.MapPath("")

strConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & strPathToTextFile & ";" & _
"Extended Properties=""text;HDR=No;"""

Dim objConnection As New
System.Data.OleDb.OleDbConnection(strConnectionStr ing)
Dim objDS As New DataSet

objConnection.Open()
Dim objDA As New OleDbDataAdapter("SELECT * FROM CSV.txt",
objConnection)

objDA.Fill(objDS, "CSV.txt")
tempString = objDS.ToString
MyDataGrid.DataSource = objDS.Tables("CSV.txt").DefaultView
MyDataGrid.DataBind()
objConnection.Close()
End Sub
Nov 18 '05 #1
1 930
MSDN had an excellent article about using ADO and delimited files. It
can be found at:

http://msdn.microsoft.com/library/de...l=/library/en-
us/dnclinic/html/scripting03092004.asp

The one thing I notice is you are missing the extended property
"FMT=delimited" Refer to the article for specifics. If the link doesn't
work you can search for the title: "Much ADO About Text Files"

Best of luck!

j.****@gmbsupport.com (Jullietta) wrote in
news:a8**************************@posting.google.c om:
Hi,

I'm trying to upload a CSV file into a dataset and then trying to
display the dataset using a datagrid.

However, I can only seem to read the first element in the CSV file and
it is being display with a funny 'yp' character.
Here's the code if anyone can spot the problem ... thanx in
advance!!~!
Dim strConnectionString As String
Dim strPathToTextFile As String

Dim tempString As String

strPathToTextFile = Server.MapPath("")

strConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & strPathToTextFile & ";" & _
"Extended Properties=""text;HDR=No;"""

Dim objConnection As New
System.Data.OleDb.OleDbConnection(strConnectionStr ing)
Dim objDS As New DataSet

objConnection.Open()
Dim objDA As New OleDbDataAdapter("SELECT * FROM CSV.txt",
objConnection)

objDA.Fill(objDS, "CSV.txt")
tempString = objDS.ToString
MyDataGrid.DataSource = objDS.Tables("CSV.txt").DefaultView
MyDataGrid.DataBind()
objConnection.Close()
End Sub


Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Billy Jacobs | last post by:
I posted this before but the person who answered it obviously completely misunderstood what I was talking about. I have a datagrid which is bound to a dataset table that I generate...
4
by: Terry | last post by:
Hey, Having somewhat of an issue, I have a datagrid which is giving me issues. The Datagrid is setup for the user to double click the row, the row is selected and data within that row populates a...
2
by: Daniel Walzenbach | last post by:
Hi, I created an ASP.NET Datagrid where a single row can be selected by clicking anywhere on the row (according to...
0
by: Wee Bubba | last post by:
i have just developed my first datagrid custom column. it is very simple. i know that each cell will only display a char value of 'T' or 'F'. so if the cell value is 'T' i am displaying a ticked...
2
by: DraguVaso | last post by:
Hi, I'm looking for a nice way to format the cell of my datagrid according to some predefined 'rules'. I found a lot on the site of George shepherd, but it wasn't really what I was looking for:...
21
by: coleenholley | last post by:
I've been trying since last Friday to get an answer on how to get a SPECIFIC row.cell value from a datagrid. I've had plenty of suggestions, but nothing works to get the value from a SPECIFIC Row...
10
by: JohnR | last post by:
I have a datatable as the datasource to a datagrid. The datagrid has a datagridtablestyle defined. I use the datagridtablestyle to change the order of the columns (so they can be different than...
3
by: Ryan Liu | last post by:
Can someone give a sample to prevent a row from being deleted in a datatable? I tried e.Row.RejectChanges(); in dt_RowDeleting() but seems does not work. I need verify if there other data...
3
by: sophie_newbie | last post by:
Hi, I want to store python text strings that characters like "é" "Č" in a mysql varchar text field. Now my problem is that mysql does not seem to accept these characters. I'm wondering if there...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.