Click here to Skip to main content
15,897,371 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Using C# class in VB.Net Pin
Dave Kreskowiak1-Nov-07 2:25
mveDave Kreskowiak1-Nov-07 2:25 
AnswerRe: Using C# class in VB.Net Pin
Luc Pattyn1-Nov-07 4:10
sitebuilderLuc Pattyn1-Nov-07 4:10 
GeneralRe: Using C# class in VB.Net Pin
Ri Qen-Sin12-Nov-07 15:49
Ri Qen-Sin12-Nov-07 15:49 
QuestionSql 2000 to sql2005 Pin
ramyasangeet31-Oct-07 20:19
ramyasangeet31-Oct-07 20:19 
AnswerRe: Sql 2000 to sql2005 Pin
Vimalsoft(Pty) Ltd31-Oct-07 22:35
professionalVimalsoft(Pty) Ltd31-Oct-07 22:35 
QuestionQuestion on Calling a Windows Forms Pin
Leo Lai31-Oct-07 16:10
Leo Lai31-Oct-07 16:10 
AnswerRe: Question on Calling a Windows Forms Pin
Mycroft Holmes31-Oct-07 22:12
professionalMycroft Holmes31-Oct-07 22:12 
QuestionWell coded or not? Pin
Sam Heller31-Oct-07 12:16
Sam Heller31-Oct-07 12:16 
I have the following code. I am returning a string. If I use return where I have in this way is there a chance I could have left some database connections open still?

Does it skip the connection "Finish with resources" section?

I believe this is the cause to alot of timeout exceptions. Any help much appreciated.

    <br />
'Gets any previosuly create about us text <br />
    Public Function GetAboutUs(ByVal ProductID As Int32) As String<br />
        ' Create Connection<br />
        Dim HSConn As New SqlConnection(ConfigurationManager.ConnectionStrings("RemoteSqlServer").ConnectionString)<br />
        ' Create data reader<br />
        Dim dr As SqlDataReader<br />
        'Declare Command<br />
        Dim HSComm As New SqlCommand()<br />
<br />
        Try<br />
            HSConn.Open()<br />
            ' Provide connection<br />
            HSComm.Connection = HSConn<br />
            ' Provide command type and command<br />
            HSComm.CommandType = CommandType.StoredProcedure<br />
            HSComm.Parameters.AddWithValue("ProductID", ProductID)<br />
            HSComm.CommandText = "SP_ProductAboutUsSelect"<br />
<br />
            'Execute the command<br />
            dr = HSComm.ExecuteReader<br />
<br />
            While dr.Read()<br />
                'If there is a Tagline return it. Otherwise return nothing<br />
                If dr.IsDBNull(0) Then<br />
                    Return Nothing<br />
                Else<br />
                    Return dr.GetString(0)<br />
                End If<br />
            End While<br />
<br />
            'Return in case value is not found<br />
            Return Nothing<br />
<br />
        Catch ex As Exception<br />
            ' Failed to retrieve tagline so return false<br />
            Emailer.ErrorEmail(ex, Page)<br />
            Return Nothing<br />
        End Try<br />
<br />
        ' Finish up with resources<br />
        dr.Close()<br />
        HSConn.Close()<br />
<br />
    End Function

AnswerRe: Well coded or not? Pin
Luc Pattyn31-Oct-07 12:24
sitebuilderLuc Pattyn31-Oct-07 12:24 
AnswerRe: Well coded or not? Pin
Paul Conrad31-Oct-07 14:05
professionalPaul Conrad31-Oct-07 14:05 
QuestionButton handler Pin
fxcapt31-Oct-07 12:15
fxcapt31-Oct-07 12:15 
AnswerRe: Button handler Pin
Luc Pattyn31-Oct-07 12:28
sitebuilderLuc Pattyn31-Oct-07 12:28 
GeneralRe: Button handler Pin
fxcapt31-Oct-07 13:18
fxcapt31-Oct-07 13:18 
GeneralRe: Button handler Pin
Luc Pattyn31-Oct-07 14:11
sitebuilderLuc Pattyn31-Oct-07 14:11 
GeneralRe: Button handler Pin
fxcapt31-Oct-07 16:17
fxcapt31-Oct-07 16:17 
QuestionRead/Write PCL Pin
Fingerstyler31-Oct-07 11:52
Fingerstyler31-Oct-07 11:52 
AnswerRe: Read/Write PCL Pin
Dave Kreskowiak1-Nov-07 14:24
mveDave Kreskowiak1-Nov-07 14:24 
GeneralRe: Read/Write PCL Pin
Fingerstyler1-Nov-07 16:13
Fingerstyler1-Nov-07 16:13 
GeneralRe: Read/Write PCL Pin
Dave Kreskowiak1-Nov-07 17:48
mveDave Kreskowiak1-Nov-07 17:48 
GeneralRe: Read/Write PCL Pin
Fingerstyler5-Nov-07 9:00
Fingerstyler5-Nov-07 9:00 
QuestionSQL Assistance with ISNULL Pin
digicd131-Oct-07 9:27
digicd131-Oct-07 9:27 
AnswerRe: SQL Assistance with ISNULL Pin
pmarfleet31-Oct-07 10:07
pmarfleet31-Oct-07 10:07 
GeneralRe: SQL Assistance with ISNULL Pin
digicd131-Oct-07 10:38
digicd131-Oct-07 10:38 
GeneralRe: SQL Assistance with ISNULL Pin
pmarfleet31-Oct-07 10:50
pmarfleet31-Oct-07 10:50 
QuestionList Boxes Pin
dexter970331-Oct-07 8:59
dexter970331-Oct-07 8:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.