return in VB.net

ithang

New Member
I posted a message to one of Microsoft's newsgroups and I had the following answer. I have the book and I want a second opinion. Please read that and tell me what you think. <BR><BR><BR>>Other book are good too, but NEVER USE THE "21 days " series. >Else your<BR>>program will last for 21 days.<BR><BR>>actually the close should be in the Finally block.<BR>>Anubhav<BR><BR>"Michael " wrote in message<BR>news:eeeBFsafBHA.1996@tkmsftngp04...<BR>> It shouldn't execute anything after the return. This is why MSDN is<BR>> normally superior to reading books on beta tech.<BR>> -mike<BR>><BR>> "luczinski" wrote in message<BR>> news:046101c17d9c$2489b7e0$9be62ecf@tkmsftngxa03.. .<BR>> > I saw an example in Sams Teach Yourself ASP.NET in 21 Days<BR>> > (Portuguese Version) that made me confused. In listing<BR>> > 15.4 there is this function:<BR>> ><BR>> > public function SelectSql(strSelect as string) as _<BR>> > OleDbDataReader<BR>> > try<BR>> > obConn = new OleDbConnection(ConnectionString)<BR>> > objCmd = new OleDbCommand( strSelect, objConn )<BR>> > objCmd.Connection.Open<BR>> > return objCmd.ExecuteReader<BR>> > objCmd.Connection.Close()<BR>> > catch ex as OleDbException<BR>> > return nothing<BR>> > end try<BR>> > end function<BR>> ><BR>> ><BR>> > My question is:<BR>> > Is the line -<BR>> > objCmd.Connection.Close()<BR>> > - executed even if I have a return before this?<BR>> ><BR>> ><BR>> ><BR>> ><BR>><BR>>
 
Back
Top