Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - BeginExecuteNonQuery IAsyncResult

Reply
 
Old 08-11-2009   #1 (permalink)
Rich, Justin Adam


 
 

BeginExecuteNonQuery IAsyncResult

So im trying to do a SQL BeginExecuteNonQuery which seems to kick off fine
the problem is detecting when its done.

i do something like this to start it

$result = $sqlcmd.BeginExecuteNonQuery()

that kicks off no problem (im having it run a backup, i can watch it create
the backup file)

if i do $result.iscompleted i get nothing. if i do just $result i get two
empty lines.

if i do $result | get-members i get this


TypeName: System.Data.Common.DbAsyncResult

Name MemberType Definition
---- ---------- ----------
Equals Method System.Boolean Equals(Object obj)
GetHashCode Method System.Int32 GetHashCode()
GetType Method System.Type GetType()
ToString Method System.String ToString()


so its a DbAsyncResult, which i guess if fine but MSDN refers to an
IAsyncResult. i tried to create the IAsyncResult with a new-object prior to
running the command but it doesnt find a constructor it likes...

when i EndExecuteNonQuery i get a -1 (i assume thats a success?) and it
seems ok

anyone know what im missing?

Thanks
Justin


My System SpecsSystem Spec
Reply

Thread Tools



Vista Forums 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 Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46