Sreekanth Reddy
when connection will close in disconnected architecture if I dont use conobject.close() method?
By Sreekanth Reddy in ASP.NET on Feb 13 2017
  • Suresh Molabanti
    Apr, 2017 25

    we can use statement using(sqlconnection con=new sqlconnection()) { }

    • 3
  • Rajkiran Swain
    May, 2017 15

    no need to close the connection

    • 2
  • Bhola Parit
    Apr, 2017 5

    Disconnected architecture means, you don’t need to connect always when you want to get data from the database. You do not need to open the connection explicitly. Once we fill data in dataset or datatable using fill method , the connection gets closed automatically.

    • 2
  • Sulekh Kumar
    Mar, 2017 28

    if you dont use conobject.close() method connection will close (in disconnected architecture) if it sat idle for certain period of time automatically.

    • 1
  • Jefferson S. Motta
    Jul, 2018 25

    You must use: using ( SqlConnection oCnn = new SqlConnection()) {// your code here} // in the last line of the using the connection 'll be closed.If you do not close your connection, your Project will run slowly across multiple user scenarios.

    • 0
  • Suresh Kumar
    Oct, 2017 28

    use try{} ,catch{}, final{} ,or use "using{}"

    • 0
  • Ganesh Kharde
    Oct, 2017 16

    con.disposed()

    • 0
  • Mukesh Kumar
    Aug, 2017 23

    by the use of using block like using{}

    • 0
  • Gopal Sharma
    Jul, 2017 28

    Its depend on code if use DataAdapter then this will auto open and close on .fill command. In other case when you use conobj.open() and execute some query and do not close the connection then its depend on connection time out property.

    • 0
  • Deepak Kumar
    Jul, 2017 26

    No need to explicitly open and close the connection in disconnected architecture.

    • 0
  • Vishnu Reddy
    Jul, 2017 17

    After completion of the main method.

    • 0
  • Rajavel G
    May, 2017 12

    finally{if (cn != null && cn.State == System.Data.ConnectionState.Open){cn.dispose();}}

    • 0
  • Dharmraj Thakur
    May, 2017 2

    You don't need to close the connection... It will automatic open and close the connection when needed.

    • 0
  • Suresh Molabanti
    Apr, 2017 25

    we can use statement using(sqlconnection con=new sqlconnection()) { }

    • 0
  • Lawrence Peters
    Apr, 2017 24

    once your connection is Open which is paramount then closing it should not be a necessity. because there are sometimes that you will even forget to close your connection and your code will still run. so its not compulsory

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS