Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Read String from DataSet

Status
Not open for further replies.

egodette

Technical User
Jun 12, 2002
222
0
0
US
I read a CSV into a DataSet that contains digits that should be stored as String.
Example..
adus,088606108,12.00
When I read the data back using the following code
strMsg = ds.Tables(0).Rows(1)(1)
It drops the leading 0 and becomes 88606108
Reading this line
adus,05545e209,12.00 becomes 5.545E+212

How do I keep the data as a string?

 
It reads as Numeric value.
Try to get it as string value
Code:
ds.Tables(0).Rows(1).Item(1).ToString

Zameer Abdulla
 
That did not work. Im wondering if the data is being brought into the dataset as numberic. This is what I'm doing to load the data into the dataset. Is there another way that will type the data as String?

ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=P:\Administrator\scripts\IDC_Pricing\;Extended Properties='text;HDR=No;FMT=Delimited'"
CommandText = "select * from idcinput.txt"

conn = New System.Data.OleDb.OleDbConnection(ConnectionString)
Command = New System.Data.OleDb.OleDbCommand(CommandText, conn)

conn.Open()

Dim da As OleDbDataAdapter = New OleDbDataAdapter(CommandText, conn)
Dim ds As DataSet = New DataSet
' fill dataset
da.Fill(ds, "PriceTable")

 
I fixed it. I created a schema.ini and typed all the columns as Char.

Thanks for all your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top