The following bit of code saved me many hours of drudgery.
I do a find all in .net for the open database connection code,
copy it into my little app and create corresponding close connection code.
All of our asp pages need these lines of code at the end since
connections were no longer being closed automatically in our new db environment.
It not elegant or pretty but it did the job. The next logical progression would be to create a .net add-in that did this from within the IDE. Maybe next time.
Its a windows app with 2 multiline text boxes and a button.
Option Explicit On
Imports System.IO
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub TxtIn_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TxtIn.TextChanged
End Sub
Private Sub btnProcess_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnProcess.Click
process()
End Sub
Sub process()
Dim str As String
Try
txtOut.Clear()
str = "lessthanpercentsignhere" + Environment.NewLine
For Each s As String In TxtIn.Lines
Dim strOut As String
If s.IndexOf("()") > 0 Then
strOut = s.Substring(s.IndexOf("_init") + 5, s.IndexOf("()") - s.IndexOf("_init") - 5)
str = str + strOut + ".close" + Environment.NewLine
End If
Next
str = str + "percentgreaterthansignhere " + Environment.NewLine
txtOut.Text = str
Clipboard.SetText(str)
TxtIn.Clear()
Catch ex As Exception
End Try
End Sub
End Class
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment