Click here to Skip to main content
15,891,675 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Convert Type in Vb.net Pin
TheMrProgrammer1-Jul-09 1:28
TheMrProgrammer1-Jul-09 1:28 
QuestionDraw a Polygon using Pen Pin
ClueLess Ar*e30-Jun-09 20:59
ClueLess Ar*e30-Jun-09 20:59 
AnswerRe: Draw a Polygon using Pen Pin
Christian Graus30-Jun-09 21:39
protectorChristian Graus30-Jun-09 21:39 
QuestionSet a keyboard hook Pin
TheMrProgrammer30-Jun-09 20:20
TheMrProgrammer30-Jun-09 20:20 
AnswerRe: Set a keyboard hook Pin
TheMrProgrammer1-Jul-09 5:36
TheMrProgrammer1-Jul-09 5:36 
QuestionHow to do a HTTP GET request Pin
fuhaizah30-Jun-09 18:37
fuhaizah30-Jun-09 18:37 
AnswerRe: How to do a HTTP GET request Pin
Christian Graus30-Jun-09 21:41
protectorChristian Graus30-Jun-09 21:41 
QuestionProblem reading CSV file into dataset. Pin
maf66630-Jun-09 11:10
maf66630-Jun-09 11:10 
Hi,

I have a csv file which I can access and read into a dataset with the following code:

Dim conn As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & IO.Path.GetDirectoryName(strFilePath) & ";" & _
"Extended Properties=""text;HDR=Yes;FMT=Delimited"";")
Dim FileName As String = IO.Path.GetFileName(strFilePath)
Dim da As New System.Data.OleDb.OleDbDataAdapter("SELECT * FROM " & FileName, conn)
Dim ds As New DataSet
da.Fill(ds, "FileImport")

This works great for the most part but it seems to be converting one of the fields to an integer instead of a decimal. For example: In my csv file I have a PreCost and PostCost column. I've opened up the csv file with notepad and verified that one of the rows contains 1.46 for the PreCost and 1.46 for the postcost. However, using the above code, the dataset after the fill command contains 1.46 for the Precost value and 1 for the postCost value.

I could understand this if the PreCost and PostCost both were converted to 1 but why would only one field get read correctly.

Here's a sample row from the csv file:

01111111 ,01111111111 ,Joe Bloggs ,xxxxxxxx ,18-MAY-2009,11:59:46,01111111111 ,NON GEOGRAPHIC NUMBER ,PEAK ,00:08:34 ,0 ,Y ,N ,1.46 ,1.46 ,

You will notice the 1.46 values for PreCost and PostCost. There is also a blank field after PostCost.

Anyone got any ideas why the dataAdapter.Fill method would do this? and how I get around it?

Updated: I've just tried saving a new csv file with just the row above and headers. The "1.46" values were converted correctly. So why would the original file not process any of the PostCost columns correctly? It appears that everything after the "." is ignored rather than rounded. ie. 1.85 would be converted to 1 and 0.85 would be 0??
AnswerRe: Problem reading CSV file into dataset. Pin
Johan Hakkesteegt1-Jul-09 2:30
Johan Hakkesteegt1-Jul-09 2:30 
GeneralRe: Problem reading CSV file into dataset. Pin
maf6661-Jul-09 3:20
maf6661-Jul-09 3:20 
QuestionVB.net 2005 (getModuleFileNameEx) Pin
johnl012930-Jun-09 9:41
johnl012930-Jun-09 9:41 
QuestionDeserialize PHP Encoded Data Pin
GGP130-Jun-09 9:32
GGP130-Jun-09 9:32 
AnswerRe: Deserialize PHP Encoded Data Pin
Dave Kreskowiak30-Jun-09 10:40
mveDave Kreskowiak30-Jun-09 10:40 
Questionresizing contols in a form Pin
sa_runner30-Jun-09 8:38
sa_runner30-Jun-09 8:38 
AnswerRe: resizing contols in a form Pin
Eslam Afifi30-Jun-09 9:48
Eslam Afifi30-Jun-09 9:48 
AnswerRe: resizing contols in a form Pin
Jon_Boy1-Jul-09 1:27
Jon_Boy1-Jul-09 1:27 
AnswerRe: resizing contols in a form Pin
sa_runner1-Jul-09 3:40
sa_runner1-Jul-09 3:40 
Questionhow to connect a database to VB.net with codes Pin
myperacq30-Jun-09 4:16
myperacq30-Jun-09 4:16 
AnswerRe: how to connect a database to VB.net with codes PinPopular
Tom Deketelaere30-Jun-09 4:27
professionalTom Deketelaere30-Jun-09 4:27 
GeneralRe: how to connect a database to VB.net with codes Pin
JC.KaNNaN30-Jun-09 18:20
JC.KaNNaN30-Jun-09 18:20 
QuestionDesktop background Pin
The real $M@30-Jun-09 3:35
The real $M@30-Jun-09 3:35 
AnswerRe: Desktop background Pin
Tom Deketelaere30-Jun-09 4:18
professionalTom Deketelaere30-Jun-09 4:18 
AnswerRe: Desktop background Pin
Sk9330-Jun-09 5:43
Sk9330-Jun-09 5:43 
AnswerRe: Desktop background Pin
chilinhhacker13-Jul-09 19:17
chilinhhacker13-Jul-09 19:17 
GeneralRe: Desktop background Pin
The real $M@14-Jul-09 5:25
The real $M@14-Jul-09 5:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.