Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

MoW's blog: "working with csv files part one" works with RC2?

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 11-09-2006   #1 (permalink)
Marco Shaw
Guest


 

MoW's blog: "working with csv files part one" works with RC2?

Copied the helper functions exactly as is:
http://mow001.blogspot.com/2006/03/w...-part-one.html

I get an error seemingly from "fill" below:

PS C:\> gc mow-getdata.ps1
function get-DataTable {
Param ($name )
$cmd = new-object System.Data.OleDb.OleDbCommand("Select * from
[$name]",$Conn)
$da = new-object System.Data.OleDb.OleDbDataAdapter($cmd)
$dt = new-object System.Data.dataTable
[void]$da.fill($dt)
$dt.TableName = $name.split("#")[0]
return $dt
}

PS C:\> connect-csv c:\

TABLE_NAME
----------
test#csv

PS C:\> get-datatable test#csv
Exception calling "Fill" with "1" argument(s): "Fill:
SelectCommand.Connection property has not been initialized."
At C:\mow-getdata.ps1:6 char:17
+ [void]$da.fill( <<<< $dt)



My System SpecsSystem Spec
Old 11-09-2006   #2 (permalink)
Marco Shaw
Guest


 

Re: MoW's blog: "working with csv files part one" works with RC2?

> Copied the helper functions exactly as is:
> http://mow001.blogspot.com/2006/03/w...-part-one.html
>
> I get an error seemingly from "fill" below:


I did something wrong, likely when loading the scripts/functions. I'm still
having problems though. get-datatable doesn't retrun any human readable
information at all:

PS C:\> . get-datatable test#csv

ÿ_n NoName
--- ------








PS C:\> gc test.csv
name,logon
marco,111
shaw,222
PS C:\> import-csv test.csv

name logon
---- -----
marco 111
shaw 222


My System SpecsSystem Spec
Old 11-09-2006   #3 (permalink)
Marco Shaw
Guest


 

Re: MoW's blog: "working with csv files part one" works with RC2?


> PS C:\> . get-datatable test#csv
>
> ÿ_n NoName
> --- ------


I probably need to take more care how I write my .csv files. I think I've
gotten a small test working OK now.

Marco


My System SpecsSystem Spec
Old 11-10-2006   #4 (permalink)
/\/\o\/\/ [MVP]
Guest


 

Re: MoW's blog: "working with csv files part one" works with RC2?

Glad you got it going, (I think you mixed unicode / ascii )

I also have some issues with RC2 and returning a DataSet or DataTable,
it gets converted to an Array of objects when returned from a function in RC2

it was not like this before, workaround :
change :

return $dt

to:

return ,$dt

(Note the comma that wraps it in another array ($null,$dt) ,
that second array gets "stripped off" and the dataset will remain.

for the rest I think all works.
if you got more problem please let me know

Greetings /\/\o\/\/
www.ThePowerShellGuy.com


"Marco Shaw" wrote:

>
> > PS C:\> . get-datatable test#csv
> >
> > ÿ_n NoName
> > --- ------

>
> I probably need to take more care how I write my .csv files. I think I've
> gotten a small test working OK now.
>
> Marco
>
>
>

My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Offline Files "Change Limits" button not working Eriq Vista networking & sharing 3 06-17-2008 08:03 PM
OT > The live writer "blog this" button addon For FireFox, does not work now Joe cann Live Mail 1 01-26-2008 12:33 AM
Works 8.5 in Vista: "Microsoft Works has stopped working" Maggie472 Vista General 2 01-11-2008 04:15 PM
Internet Explorer 7 for Windows Vista not prompting me to "Open/Run" or "Save" files Brandon Taylor Vista General 2 04-01-2007 04:45 PM
Blue Screen during the "expanding Files" part of the install =?Utf-8?B?Q29ybmZsYWtlcw==?= Vista General 9 09-20-2006 04:35 AM


Update your Vista Drivers Update Your Drivers Now!!

Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008