Web Forms :: How To Avoid ExecuteReader Requires Open And Available Connection

Feb 25, 2016

Some time i getting error below ,but i am did'nt used excutereader

ExecuteReader requires an open and available Connection. The connection's current state is closed.

This my code,

try { if (con.State != ConnectionState.Open) con.Open(); string result;
string Queryip = "ViewIp"; SqlCommand cmdip = new SqlCommand("ViewTranscation", con);
cmdip.CommandType = CommandType.StoredProcedure; cmdip.Parameters.AddWithValue("@QueryType", Queryip); cmdip.Parameters.AddWithValue("@Input1", "");

[Code] ....

View 1 Replies


Similar Messages:

Visual Studio :: Error Unable To Add Data Connection. ExecuteScalar Requires An Open And Available Connection. The Connection's Current State Is Closed?

Sep 13, 2010

I'm using Visual Studio 2008, and my database is SQL Server 2000.

I want to add a connection to the Server Explorer in VS. The Data source is Microsoft SQL Server (SqlClient). After entering in all my information and I click Test Connection, it is successful.

But when I click OK, I get the error:

Unable to add data connection. ExecuteScalar requires an open and available connection. The connection's current state is closed.

View 3 Replies

Web Forms :: ExecuteScalar Requires Open And Available Connection

May 7, 2015

ExecuteScalar requires an open and available Connection. The connection's current state is closed.

namespace ITS_Group{ public partial class Login : System.Web.UI.Page {
private DataTable GetData(SqlCommand cmd) {
DataTable dt = new DataTable();
String strConnString = System.Configuration.ConfigurationManager.ConnectionStrings[1].ConnectionString;
SqlConnection con = new SqlConnection(strConnString);

[CODE]..

View 1 Replies

Web Forms :: Execute Reader Requires Open And Available Connection Current State Is Connecting

May 7, 2015

I would like to ask why I encounter this error when multiple user accessing in my online page.

Here is the error message.

Execute Reader requires an open and available Connection's current state is connecting.

View 1 Replies

DataSource Controls :: ExecuteNonQuery Requires An Open And Available Connection?

Feb 4, 2010

I've a web form named contest, where users are to register for it. When the register is clicked on, details entered by the user will be saved into the database, but before it will check if the user has already participated in the contest (using AJAX). If the user has already participated, the button will be disabled. The problem is there is an error when I click on the register button.

The error:

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

Here's the codes I use:

[Code]....

View 7 Replies

Access :: Error : ExecuteNonQuery Requires An Open And Available Connection?

Apr 15, 2010

We are currently migrating our test databases to a new server and I am switching one of our sites over to use them. When running the application from my development box it hits the database just fine. However when I compile and push the code out to our test server and try to use the same datbase I get the ExecuteNonQuery requires an open and available Connection. The connection's current state is closed error. I cannot seem to figure out why. Also when I point the site at our old test server it works just fine.

View 1 Replies

ADO.NET :: Connection Error "ExecuteNonQuery Requires An Open And Available Connection" After Deploying To IIS

Feb 17, 2011

I deployed my MVC app to IIS 7.0 and I keep getting the following error; ExecuteNonQuery requires an open and available Connection. The connection's current state is closed I dont get this with the app locally on my machine. Where could this error be occurring??

View 2 Replies

ADO.NET :: Getting Error That ExecuteReader: Connection Property Has Not Been Initialized?

Jan 24, 2011

protected void Button1_Click(object sender, EventArgs e)
{
SqlCommand cmd;

[code]...

I am getting error that ExecuteReader: Connection property has not been initialized

View 11 Replies

Web Forms :: MTP Server Requires A Secure Connection Or Client Was Not Authenticated

May 7, 2015

I have written the above code and im getting an error as below-System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. Learn more at at

System.Net.Mail.MailCommand.CheckResponse(SmtpStatusCode statusCode, String response) at System.Net.Mail.MailCommand.Send(SmtpConnection conn, Byte[] command, MailAddress from, Boolean allowUnicode) at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, Boolean allowUnicode, SmtpFailedRecipientException& exception) at System.Net.Mail.SmtpClient.Send(MailMessage message) at smtptest._Default.btnSend_Click(Object sender, EventArgs e) in c:usersadministratordocumentsvisual studio 2010ProjectssmtptestsmtptestDefault.aspx.cs:line 71

Its working on local but when im hosting my application im getting above error

using (MailMessage mm = new MailMessage("myid@gmail.com","reciverid@yahoo.com"))
{
mm.Subject = "test";
mm.Body = "email testing";
mm.IsBodyHtml = false;
SmtpClient smtp = new SmtpClient();

[code]....

View 1 Replies

Web Forms :: SMTP Server Requires A Secure Connection Or Client Was Not Authenticated

Oct 11, 2012

I am created a from sending mails. I have tried ur code.. But I am getting under error.

The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required 

View 1 Replies

Web Forms :: Send Email Through Gmail Account - SMTP Server Requires A Secure Connection

Jan 12, 2011

i'm trying to send email through gmail account

i get this error:

The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. Learn more at

web config is like below:

[Code]....

and my code :

[Code]....

View 4 Replies

Web Forms :: Gmail Error / SMTP Server Requires A Secure Connection Or Client Was Not Authenticated

Jun 16, 2015

How to fix this error,

"The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. Learn more at"

[URL].....

View 1 Replies

Web Forms :: Sending Email - SMTP Server Requires Secure Connection Or Client Was Not Authenticated

Aug 18, 2015

I want to send a email without using gmail domain but its giving error given below...

The SMTP server requires a secure connection or the client was not authenticated. The server response was: Relaying not allowed - sender domain not local

View 1 Replies

Forms Data Controls :: SQL Error While Establishing Connection: 40 - Could Not Open A Connection

Jun 5, 2010

I previously used a datasource and a connection string to connect to my database on sql server and all orked fine. The connection string was saved in my web.config file and is: ....

View 1 Replies

Web Forms :: Data Connection Can't Open In Windows

Apr 2, 2010

I have used vs 2008 to develop an asp.net application.

This application can run in windows xp, windows vista, but can't run under windows 7.

When the application want to new an database connection, it retun null.

I am using sqlserver 2005 express sp3 as my database.

The connection is :

Data Source=./SQLEXPRESS;Initial Catalog=mydb;Integrated Security=True

How can I do?

View 6 Replies

Access :: How To Avoid "There Is Already Open Datareader Associated With This Command Which Muct Be Closed

Jul 21, 2010

i am getting this error "There is already open Datareader associated with this command which muct be closed first"

what are the chances of getting this error becoz it giving me so much problem

and how can i solve this error by writing a well code

View 3 Replies

Web Forms :: Open Remote Desktop Connection From Website?

Aug 18, 2015

Is there any way to lunch Remote Desktop Connection from web server ?

im using code in below, it's working from my PC but it dose not working from web server.

Dim retval As Object 

Dim MyIPAddress as string = "10.10.10.10"

retval = Shell("C:Windowssystem32mstsc.exe /CONSOLE /f /v: " + MyIPAddress , vbMaximizedFocus)

View 1 Replies

Web Forms :: Login Page - Connection Was Not Closed / Current State Is Open

Apr 14, 2013

In my asp.net +vb+access web i have made a login page and the code is as under

Dim connectString As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:webauth.mdb"
Dim con As OleDbConnection = New OleDbConnection(connectString)
con.Open()
Dim cmd As New OleDbCommand("select * from Users where userid =@userid and Password=@password", con)
cmd.Parameters.AddWithValue("@userid", txtUserName.Text)

[Code] ....

I am getting error The connection was not closed. The connection's current state is open.

View 1 Replies

Could Not Open A Connection To SQL Server?

Aug 31, 2010

I have problems connecting to my database server. The database server is not local, I am connected via its IP address. It works fine in my development machine. After publishing the website to my server, it can not connect to my database server. A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)Why can't my publish server connect to the database server, whereas it works fine through the development machine?

View 5 Replies

ADO.NET :: Open And Close Connection?

Mar 23, 2011

When should i open and close the database connection.and which are best data classes (for e.g dataset, datatable etc) should i use when connection is open or close.

View 3 Replies

Web Forms :: ExecuteReader - No Datagrid Results Returned Since Reader?

Nov 1, 2010

I am having problems with the following. On debugging I find that when strKeywords = '', reader = "System.Data.SqlClient.SqlDataReader". However, as soon as strKeywords takes the value of anything else, reader = nothing. But the stored procedure handles the arguments fine, so I am very confused!

[Code]....

View 3 Replies

ADO.NET :: Open SQL Server Connection Troubleshooting?

Sep 2, 2010

This is regarding ASP.Net (VB) 2.0 and SQL Server 2008. My project's (there is only one in my solution) has a "Start Action" set to a "Specific Page" (..FormsfrmMain.aspx). Occasionally (though not always) a large number of connections (30+) will be opened prior to the frmMain.PreInit event. These connections stay open for quite some time. I am closing all of my connections with extreme prejudice. In my "finally" clause of my try...catch I have myconnection.close. Immediately after the "End Try" I have myconnection.dispose (redundant, I know). I have accounted for all connections. I placed a breakpoint on frmMain.PreInit and then (sometimes) a large number of connections (used SSMS to run sp_who and sp_who2) will have just opened.What would open a large number of connections prior to the starting page's preinit event? I am closing (and then disposing) all of my connections. I thought that I must be missing a myconnection.close in the "finally" clause, but I have looked repeatedly and cannot find anywhere that a connection is open and then not closed. Also, I do not believe that I have even opened a connection prior to the frmMain's preinit event.

View 3 Replies

SQL Server :: Connection Is Currently Open For Database?

Oct 20, 2010

I devlopyed on asp.net application in IIS, i need to know how many current database connection is open for the database..

so how can i check how many connection are currently using for this database... if we dont want some connection how can we kill the connection

View 2 Replies

Php - Keep Sql Connection Open For Iterating Many Requests?

Jan 26, 2011

this is general to any operation calling an SQL server, or anything requiring an open connection at that.Say I have anywhere from 20 to 1000 Select calls to make for each item in data being looped. For each step, I'll select from sql, store data locally in a struct, then proceed. This is not a very expensive call, so should I keep the connection open for the entire loop? Or should I open and close every step? How expensive in run time is opening a connection? I would think it'd be better to keep the connection open, but would like to get the correct response for this.

View 4 Replies

Open A Connection Object In A Windows Service?

Nov 5, 2010

Using vb.net 2005

I am trying to open a connection object in a windows service but getting an error, what do i need to do:

what I have now:

[Code]....

on the Open line i'm getting a squiggly error saying "declaration expected" for the MyCon.Open.

do I need to import something?

View 6 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved