Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > vb equivalent ?

Reply
Thread Tools

vb equivalent ?

 
 
Jon Paal
Guest
Posts: n/a
 
      10-08-2006
what is vb equivalent to this C# code ?
converters failed to handle this

"using (SQLiteTransaction mytransaction = myconnection.BeginTransaction())"


 
Reply With Quote
 
 
 
 
Mischa Kroon
Guest
Posts: n/a
 
      10-08-2006
If I'm not mistaking:
dim mytransaction as SQLiteTransaction = myconnection.BeginTransaction()


"Jon Paal" <Jon[ nospam ]Paal @ everywhere dot com> wrote in message
news:(E-Mail Removed)...
> what is vb equivalent to this C# code ?
> converters failed to handle this
>
> "using (SQLiteTransaction mytransaction =
> myconnection.BeginTransaction())"
>
>



 
Reply With Quote
 
 
 
 
ThunderMusic
Guest
Posts: n/a
 
      10-08-2006
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: http://www.velocityreviews.com/forums/(E-Mail Removed)...
> what is vb equivalent to this C# code ?
> converters failed to handle this
>
> "using (SQLiteTransaction mytransaction =
> myconnection.BeginTransaction())"
>
>



 
Reply With Quote
 
=?Utf-8?B?RGF2aWQgQW50b24=?=
Guest
Posts: n/a
 
      10-08-2006
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())"
>
>
>

 
Reply With Quote
 
Cowboy \(Gregory A. Beamer\)
Guest
Posts: n/a
 
      10-08-2006
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:(E-Mail Removed)...
> what is vb equivalent to this C# code ?
> converters failed to handle this
>
> "using (SQLiteTransaction mytransaction =
> myconnection.BeginTransaction())"
>
>



 
Reply With Quote
 
=?Utf-8?B?RGF2aWQgQW50b24=?=
Guest
Posts: n/a
 
      10-09-2006
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:(E-Mail Removed)...
> > what is vb equivalent to this C# code ?
> > converters failed to handle this
> >
> > "using (SQLiteTransaction mytransaction =
> > myconnection.BeginTransaction())"
> >
> >

>
>
>

 
Reply With Quote
 
ThunderMusic
Guest
Posts: n/a
 
      10-09-2006
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: (E-Mail Removed)...
> what is vb equivalent to this C# code ?
> converters failed to handle this
>
> "using (SQLiteTransaction mytransaction =
> myconnection.BeginTransaction())"
>
>



 
Reply With Quote
 
Jon Paal
Guest
Posts: n/a
 
      10-09-2006
it's not a C# project...


"ThunderMusic" <NO.danlat.at.hotmail.com.SPAM> wrote in message news:(E-Mail Removed)...
> 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: (E-Mail Removed)...
>> what is vb equivalent to this C# code ?
>> converters failed to handle this
>>
>> "using (SQLiteTransaction mytransaction = myconnection.BeginTransaction())"
>>
>>

>
>



 
Reply With Quote
 
Cowboy \(Gregory A. Beamer\)
Guest
Posts: n/a
 
      10-09-2006
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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:(E-Mail Removed)...
>> > what is vb equivalent to this C# code ?
>> > converters failed to handle this
>> >
>> > "using (SQLiteTransaction mytransaction =
>> > myconnection.BeginTransaction())"
>> >
>> >

>>
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Warning:Xst:382 - Register A is equivalent to B mag VHDL 1 05-19-2005 05:10 PM
instancename of current entity/architecture -- equivalent to C++ this??? Eric Peers VHDL 2 11-18-2004 05:23 PM
VHDL equivalent of verilog trireg Sanjeev VHDL 4 07-23-2004 09:55 AM
equivalent types in different packages Lolo VHDL 3 09-22-2003 03:23 PM
Re: Image Scanning - TWAIN equivalent Brendan Duffy ASP .Net 0 07-24-2003 08:29 AM



Advertisments