vb equivalent ?

Discussion in 'ASP .Net' started by Jon Paal, Oct 8, 2006.

  1. Jon   Paal

    Jon Paal Guest

    what is vb equivalent to this C# code ?
    converters failed to handle this

    "using (SQLiteTransaction mytransaction = myconnection.BeginTransaction())"
     
    Jon Paal, Oct 8, 2006
    #1
    1. Advertising

  2. Jon   Paal

    Mischa Kroon Guest

    If I'm not mistaking:
    dim mytransaction as SQLiteTransaction = myconnection.BeginTransaction()


    "Jon Paal" <Jon[ nospam ]Paal @ everywhere dot com> wrote in message
    news:...
    > what is vb equivalent to this C# code ?
    > converters failed to handle this
    >
    > "using (SQLiteTransaction mytransaction =
    > myconnection.BeginTransaction())"
    >
    >
     
    Mischa Kroon, Oct 8, 2006
    #2
    1. Advertising

  3. Jon   Paal

    ThunderMusic Guest

    there's no equivalent (as far as I know) for a C# using in VB... the C#
    using creates the object and disposes it at the end and VB using is just for
    shortcuts... There's not relation at all between the two....

    the equivalent would be to dim your variable and dispose it explicitly in
    your code when you don't need it anymore...

    I hope it helps

    ThunderMusic

    "Jon Paal" <Jon[ nospam ]Paal @ everywhere dot com> a écrit dans le message
    de news: ...
    > what is vb equivalent to this C# code ?
    > converters failed to handle this
    >
    > "using (SQLiteTransaction mytransaction =
    > myconnection.BeginTransaction())"
    >
    >
     
    ThunderMusic, Oct 8, 2006
    #3
  4. There is certainly an equivalent in either 2003 or 2005:
    2005:
    Using mytransaction As SQLiteTransaction = myconnection.BeginTransaction()
    2003:
    Dim mytransaction As SQLiteTransaction = myconnection.BeginTransaction()
    Try
    foo
    Finally
    CType(mytransaction, IDisposable).Dispose()
    End Try
    --
    David Anton
    www.tangiblesoftwaresolutions.com
    Instant C#: VB to C# converter
    Instant VB: C# to VB converter
    Instant C++: C#/VB to C++ converter
    Instant Python: VB to Python converter


    "Jon Paal" wrote:

    > what is vb equivalent to this C# code ?
    > converters failed to handle this
    >
    > "using (SQLiteTransaction mytransaction = myconnection.BeginTransaction())"
    >
    >
    >
     
    =?Utf-8?B?RGF2aWQgQW50b24=?=, Oct 8, 2006
    #4
  5. In Framework 2.0, you can use Using.

    Using mytransaction As SQLiteTransaction = myconnection.BeginTransaction()

    In version 1.1, there is no true equivalent, although you can accomplish the
    exact same thing in either 1.1 or 2.0 with this:

    Try
    Dim mytransaction As SQLiteTransaction = myconnection.BeginTransaction()
    Finally
    Dim disposableObject as IDisposable = CType(mytransaction, IDisposable)
    disposableObject.DIspose()
    End Try

    Note, however, that casting as IDisposable merely imitates the action of
    Using and does not add a real Dispose() method to the class.

    --
    Gregory A. Beamer
    MVP; MCP: +I, SE, SD, DBA
    http://gregorybeamer.spaces.live.com/

    *************************************************
    Think Outside the Box!
    *************************************************
    "Jon Paal" <Jon[ nospam ]Paal @ everywhere dot com> wrote in message
    news:...
    > what is vb equivalent to this C# code ?
    > converters failed to handle this
    >
    > "using (SQLiteTransaction mytransaction =
    > myconnection.BeginTransaction())"
    >
    >
     
    Cowboy \(Gregory A. Beamer\), Oct 9, 2006
    #5
  6. That won't quite compile - see my earlier post Gregory.
    --
    David Anton
    www.tangiblesoftwaresolutions.com
    Instant C#: VB to C# converter
    Instant VB: C# to VB converter
    Instant C++: C#/VB to C++ converter
    Instant Python: VB to Python converter


    "Cowboy (Gregory A. Beamer)" wrote:

    > In Framework 2.0, you can use Using.
    >
    > Using mytransaction As SQLiteTransaction = myconnection.BeginTransaction()
    >
    > In version 1.1, there is no true equivalent, although you can accomplish the
    > exact same thing in either 1.1 or 2.0 with this:
    >
    > Try
    > Dim mytransaction As SQLiteTransaction = myconnection.BeginTransaction()
    > Finally
    > Dim disposableObject as IDisposable = CType(mytransaction, IDisposable)
    > disposableObject.DIspose()
    > End Try
    >
    > Note, however, that casting as IDisposable merely imitates the action of
    > Using and does not add a real Dispose() method to the class.
    >
    > --
    > Gregory A. Beamer
    > MVP; MCP: +I, SE, SD, DBA
    > http://gregorybeamer.spaces.live.com/
    >
    > *************************************************
    > Think Outside the Box!
    > *************************************************
    > "Jon Paal" <Jon[ nospam ]Paal @ everywhere dot com> wrote in message
    > news:...
    > > what is vb equivalent to this C# code ?
    > > converters failed to handle this
    > >
    > > "using (SQLiteTransaction mytransaction =
    > > myconnection.BeginTransaction())"
    > >
    > >

    >
    >
    >
     
    =?Utf-8?B?RGF2aWQgQW50b24=?=, Oct 9, 2006
    #6
  7. Jon   Paal

    ThunderMusic Guest

    the question is... why would you convert a C# project into VB? they are
    both alike and C# offers a bit more things over VB... I can't see why
    someone would convert a C# project into VB...

    ThunderMusic

    "Jon Paal" <Jon[ nospam ]Paal @ everywhere dot com> a écrit dans le message
    de news: ...
    > what is vb equivalent to this C# code ?
    > converters failed to handle this
    >
    > "using (SQLiteTransaction mytransaction =
    > myconnection.BeginTransaction())"
    >
    >
     
    ThunderMusic, Oct 9, 2006
    #7
  8. Jon   Paal

    Jon Paal Guest

    it's not a C# project...


    "ThunderMusic" <NO.danlat.at.hotmail.com.SPAM> wrote in message news:...
    > the question is... why would you convert a C# project into VB? they are both alike and C# offers a bit more things over VB... I
    > can't see why someone would convert a C# project into VB...
    >
    > ThunderMusic
    >
    > "Jon Paal" <Jon[ nospam ]Paal @ everywhere dot com> a écrit dans le message de news: ...
    >> what is vb equivalent to this C# code ?
    >> converters failed to handle this
    >>
    >> "using (SQLiteTransaction mytransaction = myconnection.BeginTransaction())"
    >>
    >>

    >
    >
     
    Jon Paal, Oct 9, 2006
    #8
  9. I was working offline when I wrote and sent as soon as I got hooked back up,
    so I did not see your response until today. I will mark that one down. I
    also did not test the code, but I am more a C# guy, if that gives me any
    points. :)

    More important than the transaction is the connection object, which does
    have a Dispose() method and SHOULD be disposed.

    --
    Gregory A. Beamer
    MVP; MCP: +I, SE, SD, DBA
    http://gregorybeamer.spaces.live.com

    *************************************************
    Think outside of the box!
    *************************************************
    "David Anton" <> wrote in message
    news:...
    > That won't quite compile - see my earlier post Gregory.
    > --
    > David Anton
    > www.tangiblesoftwaresolutions.com
    > Instant C#: VB to C# converter
    > Instant VB: C# to VB converter
    > Instant C++: C#/VB to C++ converter
    > Instant Python: VB to Python converter
    >
    >
    > "Cowboy (Gregory A. Beamer)" wrote:
    >
    >> In Framework 2.0, you can use Using.
    >>
    >> Using mytransaction As SQLiteTransaction =
    >> myconnection.BeginTransaction()
    >>
    >> In version 1.1, there is no true equivalent, although you can accomplish
    >> the
    >> exact same thing in either 1.1 or 2.0 with this:
    >>
    >> Try
    >> Dim mytransaction As SQLiteTransaction =
    >> myconnection.BeginTransaction()
    >> Finally
    >> Dim disposableObject as IDisposable = CType(mytransaction,
    >> IDisposable)
    >> disposableObject.DIspose()
    >> End Try
    >>
    >> Note, however, that casting as IDisposable merely imitates the action of
    >> Using and does not add a real Dispose() method to the class.
    >>
    >> --
    >> Gregory A. Beamer
    >> MVP; MCP: +I, SE, SD, DBA
    >> http://gregorybeamer.spaces.live.com/
    >>
    >> *************************************************
    >> Think Outside the Box!
    >> *************************************************
    >> "Jon Paal" <Jon[ nospam ]Paal @ everywhere dot com> wrote in message
    >> news:...
    >> > what is vb equivalent to this C# code ?
    >> > converters failed to handle this
    >> >
    >> > "using (SQLiteTransaction mytransaction =
    >> > myconnection.BeginTransaction())"
    >> >
    >> >

    >>
    >>
    >>
     
    Cowboy \(Gregory A. Beamer\), Oct 9, 2006
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brendan Duffy

    Re: Image Scanning - TWAIN equivalent

    Brendan Duffy, Jul 24, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    1,498
    Brendan Duffy
    Jul 24, 2003
  2. Lolo
    Replies:
    3
    Views:
    603
  3. Sanjeev
    Replies:
    4
    Views:
    3,597
    Jonathan Bromley
    Jul 23, 2004
  4. Eric Peers
    Replies:
    2
    Views:
    1,394
    Jonathan Bromley
    Nov 18, 2004
  5. mag
    Replies:
    1
    Views:
    685
    Andy Peters
    May 19, 2005
Loading...

Share This Page