Home
Blogs
Questions

Home

About Us

Blogs

Questions

Monetize

Post Job

banner

Questions about executenonquery

Read more about executenonquery

python (12.9k questions)

javascript (9.2k questions)

reactjs (4.7k questions)

java (4.2k questions)

java (4.2k questions)

c# (3.5k questions)

c# (3.5k questions)

html (3.3k questions)

Questions - executenonquery

'ExecuteNonQuery requires an open and available Connection. The connection's current state is closed.' - C#

The code: private void btnSave_Click(object sender, EventArgs e) { using (con = new SqlConnection(connectionString)) { SqlCommand c...
test-img

Richard Johnson

c#

sql

using

sqlconnection

executenonquery

Votes: 0

Answers: 1

Latest Answer

You can simply use con.Open() so connection will just get establish in case of closed state or you can add a check before opening connection (snippet below). public void LoadData() { ...
test-img

Arsal Hussain

Posts

Questions

Blogs

Where knowledge meets opportunity!

About

  • Company
  • Monetize your knowledge
  • Support

  • Platform

  • Terms & Conditions
  • Privacy statement
  • Cookie policy
  • Cookie option
  • OnlyCoders © 2025  |  All rights reserved