Hi,
I am connecting to sql databse from windows C# form.
when i close the form, then also the connection to databse
is active. Its not allowing me to delete the database.
But if i close the complete application, then databse is
delete successfully.
ANy solution ?
Regards,
Mahesh 4 1766
Mahesh:
Can you post the code?
Two quick questions:
1) How do you know the connection is still open?
2) Are you explicitly opening and closing it?
"Mahesh D. Rane" <an*******@disc ussions.microso ft.com> wrote in message
news:01******** *************** *****@phx.gbl.. . Hi,
I am connecting to sql databse from windows C# form. when i close the form, then also the connection to databse is active. Its not allowing me to delete the database. But if i close the complete application, then databse is delete successfully. ANy solution ?
Regards, Mahesh
Yes i am opening and closing the connection.
Code :
string strSalesCode = "";
SqlConnection myImageCon =
new SqlConnection(c ConnImage);
myImageCon.Open ();
SqlDataReader drReader;
string strQuery = "select
SalesCode from UserMaster where UserId=" + "'" +
cCommon.UserID. ToString() + "'";
SqlCommand myCmd = new
SqlCommand (strQuery, myImageCon) ;
drReader =
myCmd.ExecuteRe ader();
while(drReader. Read())
{
strSalesCode =
drReader["SalesCode"].ToString();
}
myImageCon.Clos e();
myCmd = null;
myImageCon = null; -----Original Message----- Mahesh:
Can you post the code?
Two quick questions:
1) How do you know the connection is still open? 2) Are you explicitly opening and closing it? "Mahesh D. Rane" <an*******@disc ussions.microso ft.com>
wrote in messagenews:01******* *************** ******@phx.gbl. .. Hi,
I am connecting to sql databse from windows C# form. when i close the form, then also the connection to
databse is active. Its not allowing me to delete the database. But if i close the complete application, then databse is delete successfully. ANy solution ?
Regards, Mahesh
.
I believe the connection pool keeps one connection open throughout the life
of the app once opened.
<an*******@disc ussions.microso ft.com> wrote in message
news:09******** *************** *****@phx.gbl.. . Yes i am opening and closing the connection.
Code :
string strSalesCode = ""; SqlConnection myImageCon = new SqlConnection(c ConnImage); myImageCon.Open ();
SqlDataReader drReader; string strQuery = "select SalesCode from UserMaster where UserId=" + "'" + cCommon.UserID. ToString() + "'"; SqlCommand myCmd = new SqlCommand (strQuery, myImageCon) ; drReader = myCmd.ExecuteRe ader();
while(drReader. Read()) { strSalesCode = drReader["SalesCode"].ToString(); }
myImageCon.Clos e(); myCmd = null; myImageCon = null;
-----Original Message----- Mahesh:
Can you post the code?
Two quick questions:
1) How do you know the connection is still open? 2) Are you explicitly opening and closing it? "Mahesh D. Rane" <an*******@disc ussions.microso ft.com> wrote in messagenews:01******* *************** ******@phx.gbl. .. Hi,
I am connecting to sql databse from windows C# form. when i close the form, then also the connection to databse is active. Its not allowing me to delete the database. But if i close the complete application, then databse is delete successfully. ANy solution ?
Regards, Mahesh
.
A couple of things...
You should be sure to use
try
open
do stuff
catch
some bad happend
finally
close <-- Close() returns a connection to the connection pool.
Your connection pools can be managed using the Connection Lifetime,
Connection Reset, Pooling, Max Pool Size, and Min Pool Size connection
string modifiers.
Connection Lifetime controls how long before a connection should be
automatically destroyed and is useful in clustering and load balancing.
Pooling can be set to either True or False, and of course it specifies
whether connection pooling should be used in your application. It follows
that Max Pool Size and Min Pool Size control just how many connections
should be automatically created in a new pool and how many connections that
pool can hold.
"William Ryan" <do********@com cast.nospam.net > wrote in message
news:#c******** ******@TK2MSFTN GP09.phx.gbl... I believe the connection pool keeps one connection open throughout the
life of the app once opened. <an*******@disc ussions.microso ft.com> wrote in message news:09******** *************** *****@phx.gbl.. . Yes i am opening and closing the connection.
Code :
string strSalesCode = ""; SqlConnection myImageCon = new SqlConnection(c ConnImage); myImageCon.Open ();
SqlDataReader drReader; string strQuery = "select SalesCode from UserMaster where UserId=" + "'" + cCommon.UserID. ToString() + "'"; SqlCommand myCmd = new SqlCommand (strQuery, myImageCon) ; drReader = myCmd.ExecuteRe ader();
while(drReader. Read()) { strSalesCode = drReader["SalesCode"].ToString(); }
myImageCon.Clos e(); myCmd = null; myImageCon = null;
-----Original Message----- Mahesh:
Can you post the code?
Two quick questions:
1) How do you know the connection is still open? 2) Are you explicitly opening and closing it? "Mahesh D. Rane" <an*******@disc ussions.microso ft.com> wrote in messagenews:01******* *************** ******@phx.gbl. .. > Hi, > > I am connecting to sql databse from windows C# form. > when i close the form, then also the connection to databse> is active. Its not allowing me to delete the database. > But if i close the complete application, then databse is > delete successfully. > ANy solution ? > > Regards, > Mahesh
.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Refky Wahib |
last post by:
Hi
I need Technical Support
I finished a Great project using .Net and SQL Server and .Net Mobile
Control
My Business case is to implement this Program to accept about 1
Million concurrent users
So I designed the project as master Node that has all administration
|
by: Refky Wahib |
last post by:
Hi
Actually I need Technical Support
I finished a Great project using .Net and SQL Server and .Net Mobile
Control
My Business case is to implement this Program to accept about 1
Million concurrent users
So I designed the project as master Node that has all administration
project and about 10 client Nodes
Those subscribers will login and I configured the replication at
Server that can publish any change to the Nodes
|
by: Rahul Anand |
last post by:
Getting SQL Exception when trying to implement Connection
based Trasaction using SQL Helper class.
I am using the follwing function to execute my stored
procs:
-=-=-=-
ExecuteScalar(ByVal transaction As SqlTransaction, _
ByVal spName As String, _
ByVal ParamArray parameterValues() As Object)
|
by: BBC1009 |
last post by:
I have an application connected to an overseas sql-server using port 1433.
But recently it always timeout the connection. Any solution to avoid
this??? I am using the VB.net Windowed Form with .net 2002, SQL-Sever 2000
Enterprise
Thanks!
|
by: mortenol |
last post by:
Hi, I am trying to connect a MS SSIS package to an AS400/DB2 database,
and I experience problem when I hit the "Create Package" button in
the "Data Link properties window".
I have understood that the packages need to be created, before I can
run any SQL on the DB2 base via SSIS(?).
Here are the steps that I have done before the problem arise:
1. In MS Visual Studios, I created a new project of type "Integration
Services".
2. On the...
| |
by: Suresh |
last post by:
Hi Guys
I have Db2 server installed on remote server. i am connecting to that
remote server by using VPN.
I want to connect that remote DB2 server instance using my local
machine DB2 development client. Bur Its gives me following error
message. I searched lots of things on net and tried on remote server
but i didnt got suceess. Can any one tell me how to set TCP\IP
|
by: b_r |
last post by:
Hi,
I'm trying to make a simple operation (insert into DB) in VB 2005 and
SQL Server.
The code is as follows:
Dim sConnectionString As String = _
"Data
Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\DB.mdf....
|
by: Usman Jamil |
last post by:
Hi
I've a class that creates a connection to a database, gets and loop on a
dataset given a query and then close the connection. When I use netstat
viewer to see if there is any connection open left, I always see that there
are 2 connections open and in "ESTABLISHED" state. Here is the piece of code
that I'm using, please tell where I'm doing it wrong. Since this class is
being used at many placed in my actual web based application that...
|
by: sherifbk |
last post by:
Problem description
==============
- I have 4 clients and 1 server (SQL server)
- 3 clients are Monitoring console 1 client is operation console
- Monitoring console collects some data from the control unit and
store them into the Sql server
- The operation console then retrieve this data from the sql for
reporting and statistics purposes
- I am using ODBC connection
- The problem is that the operation console is not able to...
|
by: Ryan Liu |
last post by:
Hi,
I have a 100 clients/ one server application, use ugly one thread pre client
approach. And both side user sync I/O.
I frequently see the error on server side(client side code is same, but I
don't see the error):
"System.IO.IOException: Unable to read data from the transport connection:A
blocking operation was interrupted by a call to WSACancelBlockingCall"
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |