Closing All (maybe Older) SQL Connections?
Feb 15, 2012I am using two SQL connections in my Program. I declare them like this:
Public SQLcon As New SqlConnection("server=(local);database=master;Trusted_Connection=True;")
[code].....
I am using two SQL connections in my Program. I declare them like this:
Public SQLcon As New SqlConnection("server=(local);database=master;Trusted_Connection=True;")
[code].....
How do I go about closing a connection if I redirect before I can close it? Does it close when the new page loads? For example:
[code].....
in vb.net, there are some applications that use adodb to access a mysql server.
[Code]...
re writing these functions is a big task - and I am not interested in doing it unless absolutely needed. Here is my problem though. even if the connection is closed (and i have stepped through the code, it closes) The connection is still visible on the sql server in a sleep state why? and how can i make sure that the connection is closed.
Using VB.Net and SQL Server 2008 R2: I have recently had a database that using sp_who2 reflects a connection ".Net SqlClient Data Provider" is still active even though the .Net application has closed and disposed of all connections.
[Code]...
Form1 is a mdi container. It has a bunch of forms that can load inside of it as mdi children. If I close each open form inside the form1, and then click the red X at the top right, application exits fine.If I click the red X without closing the forms inside I get: An unhandled exception of type 'System.CannotUnloadAppDomainException' occurred in mscorlib.dll
Additional information: Error while unloading appdomain. (Exception from HRESULT: 0x80131015) However I can break from it. How do I get the application to not show that error? What must I do to fix those inside forms or close when the red x is clicked?
Dim frm As Form
For Each frm In Forms
Set frm = Nothing
Next frm
The above code is what I used in VB6 to close all forms associated with my programs before my program closed. I have been searching for information on how to make sure all forms are closed when closing a VB2008 program.
I have seen info on using the Project Property Shutdown mode When startup form closes and I currently have this set.
Is this all that is really necessary? Will the garbage disposal close everything else to free up RAM?
Also, if I have several forms open and want to close all from the main form without closing each one individually, what is the best approach? Is there a collection like in VB6, go through the collection, compare it to the name of the main form and close it if it is not the main form?
I have the following code to close a form which is a child. The problem is that when it closes, it closes the MDI parent too.
Private Sub frmTransaction_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
If ListView1.Items.Count >= 1 Then
[Code]....
I'm using the following code to kill a program: Dim pProcess() As Process = System.Diagnostics.Process.GetProcessesByName("myprogram.exe")
For Each p As Process In pProcess p.Kill() Next
At one point it's running twice and the above code kills em all including the one currently running, resulting in an access error. Is there any way to say, kill the older myprogram.exe only. Compare both of them and see which one was executed first and terminate this one, keeping the later one running.
how can i uninstall previous version of my windows applcation which is with different name and location? on installing new versions?
View 3 RepliesI have some project that written in .net 3.5 environment. But there still some dependency to .net 2.0 .How I can find this dependence parts of the code that use the old API ? I just want to update all code to 3.5 version.Project written in vb.net.
View 4 RepliesI have a basic bit of code which i am using to delete text files within a given directory[code]...
intdays is a variable which determines how many days the files should be retained for.
To test the code i set intdays to 0, assuming that it would delete any files in the directoy. However it doesn't, but creates no errors.
The time "Now" is #2/8/2012 13:59:00 PM# which is greater than 0. But im confused as to why it doesnt then delete the file?
The software I design is for Win XP and older versions such as Win 98, ME, 2000 etc. I currently use VB6 and Win XP for development and packaging, the problem I encounter is that if I use the deployment wizard in XP, the setup will only work on an XP machine and I need to copy all my source to an older machine and use the wizard again to create another setup file which will only work on the older operating systems. Is there a way to rectify this in VB6? If not, does the new VB account for this and be able to make a setup file for older operating systems as well as XP?
View 2 Replieshow is it possible to get the CD TOC with Visual Basic 2008? Is there anywhere a tutorial about this?I have found some links but all is described with older Versions (VB 6).
View 1 Replieshow can i unistall previous version of my windows applcation which is with different name and location? on installing new versions?
View 36 RepliesI made a small program which i have sent to all users in my network. Unfortunately i forgot about older versions of framework.
Is there a quick and easy way to add older versions compatibility of framework to my project?
I have compiled a successfull application in VB 2010 using .NET 4.0. Because my workplace only supports .NET 3.5 i compiled the app under that framework, and I get the following error:
Error1Could not load file or assembly 'System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Line 123, position 5.C:\\My Project\Resources.resx123
Now under that line I have the following code:
<data name="Presentation1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Presentation1.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value></data>
I didn't write this code, i believe that it was automatically created when designing my app. It looks like something might not be supported, but am not sure.
how I can delete files in a directory that are older than 7 days and have a specific name?
View 12 RepliesI have a sheet which contains various data, from which one of them is dates. I would like a macro that will search through those dates and if it finds a date that is older than 6 months then it will delete the entire row.
View 7 RepliesI'm working on this program to delete .tmp files that are older then 5 days. The only problem that im running into is if there are no files older than 5 days to display a messagebox "There are no .tmp files older than 5 days". Im using VB.net, this is that i have so far.
Quote:
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Try
[Code].....
I have some work I need to do with some older ActiveX controls. When I install the controls (outside of Visual Studio) I get an error message:
Quote:
The procedure entry point SRWriteStringLocalCmd could not be located in the dynamic link library SankyoMP.dll
Doing a little research I get a whole bunch of different answers. Microsoft says that this is because it was written for an older version of Windows (2000 or before, I am using XP) and to contact the vendor. The vendor is out of business.
Does anybody know of a way to install and use this older ActiveX control in VB.net/Visual Studio 2005?
I need to delete older bkf files in a directory, only leaving the newest 20.
No, I can not just delete older than x days because there can be more than one backup file per day and some times it may be 2-3 days before a backup file appears.
Got a dll from a supplier that I need to call. His declaration is Declaration with Microsoft Visual Basic: [code]Now, the Sting * 20 is clearly not VB.NET, and sure enough it crashes when run - "Attempt to read or write in protected memory" and that leads me to think that there is something with that string definition - or possibly the I_Ref definition which hasn't been defined as fixed length.I've tried <VBFixedString(20)> when defining O_Err, but I have a feeling that it might not be enough when the function declaration is like that (not specifically fixed length). I cannot figure out how to specify this correctly.As a small hmmmm, the above is pasted directly from the suppliers documentation, but that't will never work, as there is a "," missing after I_Range as long... Clearly not something he has pasted from a working program.
View 9 RepliesFor instance, I read that visual basic .net didn't have operator overloads before, so wouldn't be able to use a types overloaded operators, if they aren't provided as normal methods too (Add, instead of operator+).
View 1 RepliesI'm using microsoft visual studio for VB.NET 2008. When i compiling my program it's got stuck on older version of the program, i even change some of the label text in the design mode and it still loading the old label text, is any one ever had this problem before?
View 3 RepliesI have encountered a wierd problem, and I'm unsure if this behaviour is caused by my code or by Windows itself... I can't make any sense of it! Basically, I have written an automated backup system for a text editor. It should save up to 5 backups for each filename, each in a 'AutoBackup<filename><filename>_<number>.bak' format. Here, <filename> is simply the name of the file my program is backing up, and <number> is the first 'free' number. So if the backups are "Test_1, Test_2, Test_4, Test_5", the next backup will be called "Test_3" (since 3 was 'missing'). When there are more than 5 backups, I want my code to delete the oldest files until there are again 5 backups left. I am using the following code for this:
vb.net
'Backup doc.SaveFile(path & "" & filename & "_" & newNum & ".bak") 'If more than max files, delete oldest Do While numOfFiles > maxBackups Dim d As Date Dim maxDate As Date = Date.MaxValue Dim oldestFile As String =
[code].....
Then, after another backup, Test_1.bak is again deleted!I thought this was pretty weird so I had a look at the files in windows explorer, taking a good notice of the creation date... That's when I saw that after Test_1.bak is created a second time (after a file named Test_1.bak was deleted), it carries the same creation date/time as the old (deleted) Test_1.bak..So my code still sees it as the oldest file (while it is actually the newest) and deletes it...
I need to write an app to delete files on server Older than X days to clean up disk space. The job/app needs to be scheduled to run say once in a month. Please suggest what would be the best way to handle it? Can Windows Workflow Foundaton be used to achieve the task?
View 3 Replieshow do i make a program in visual studio 10 that works on older .net frameworks?
View 1 RepliesI am currently working on a program that only I can use to send and retreve files from an external harddrive through my older laptop. But I have only just started and need help with the login form. I want my password and user on labels placed on form 2 and need form 1 to retreive them then I click the login button, however I want form1 to close if the user or password are incorrect. How could I go about placing an if then statment for if correct then it opens a new window if wrong then end program. Heres my login code so far.
Private Sub Login_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Login.Click
If User.Text = "*********" And Pass.Text = "*******" Then
MessageBox.Show("Welcome")
[Code]...
Tell me older versions of these commands to be used with .NET 1.1?
The pieces of code I am using are:
For reading a text file to a string-
Dim str As String
'reading the content of the file "test.txt" and storing it in the declared variable
[CODE]...
I have a list of directories that get files added to by other users on my network.I would like a script (triggered by scheduled task) that would detect if there are files in these folders older than 15 minutes, and send me an email. I am able to run Batch/DOS, Python, Perl, or VBS - I have them all installed on the server. As long as they can be triggered from Scheduled task.
Example:
C:UsersFTPJoeSFromCustomer <files dropped here>
C:UsersFTPMarkFromCustomer <files dropped here>
C:UsersFTPRobbieFromCustomer <files dropped here>
C:UsersFTPTammyFromCustomer <files dropped here>
[code]....