Latest developer linksBookmark and Share
 
HomeThis WeekTop MonthTop AlltimeSearchRegisterFAQ
  
 
Submit Your Link
Please login to submit your Link
 

open datareader associated with this connection error...

Posted: Dec/14/2010   By: nikhil   Points:15   Category: .NET  - ASP.Net    Views:188   Vote Up (0)   Vote Down (0)    

I'm trying to figure out how I can get around an error I get when multiple users are accessing different my site. I'm getting an error:

there is already an open datareader associated with this connection which must be closed first

It's not the same query everytime but I recently triggered it on this statement:

Dim adapterSavedState As New SQLDataAdapter("SELECT SavedStateContactView, SavedStatePropertyView, SavedStateTransView, SavedStateCompanyView FROM WebusersProfiles WHERE ContactID = '" & Session("ContactID") & "'", myConnection)
    Dim dtSavedState As New DataTable()
    adapterSavedState.Fill(dtSavedState)
         Dim rowSavedState As DataRow
         For Each rowSavedState In dtSavedState.Rows
             If Request.QueryString("View") = "Contact" Then
                SavedState = rowSavedState("SavedStateContactView").ToString()
            Else If Request.QueryString("View") = "Property" Then
                SavedState = rowSavedState("SavedStatePropertyView").ToString()
            Else If Request.QueryString("View") = "Trans" Then
                SavedState = rowSavedState("SavedStateTransView").ToString()
            Else If Request.QueryString("View") = "Company" Then
                SavedState = rowSavedState("SavedStateCompanyView").ToString()
            End If
         Next rowSavedState


I define my connection in my basepage

    Public Dim MyConnection As SqlConnection
    Public Shared Dim strSite As String = "dev"
        
    Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
        myConnection = New SqlConnection("server=xxxx;database=xxxxx;User ID=xxxxx;Password=xxxxx;")


Where is my issue and how can I overcome it? This is a .net 1.1 site so MARS I know is not available...

View Complete Post


Comments:
Be the first to comment this post.
 
Post Comment
Please login to post your comment
More Related Resources

IIS Issues - Unable to start debugging on the web server. The underlying connection was closed. The connection was closed unexpectedly.

  

All of the sudden I'm getting the following error on my local web server (Win7 64bit, IIS 7.5).  I've uninstalled & reinstalled IIS locally and it didn't fix it.  IIS is set to start up automatically and I can see that the service has been successfully started.  Upon a fresh reboot if I go into IIS and click on start website I get the following error:
"The process cannot access the file because it is being used by another process.  (Exception from HRESULT:  0x80070020"
If I try to start debugging on my local website project I get the following error:
"Unable to start debugging on the web server.  The underlying connection was closed.  The connection was closed unexpectedly."
Any ideas on what I can try?  I've been doing research on the issue and Microsoft suggest making sure no other service is listening on the same ports.  I've verified that this isn't the issue.

All of the sudden I'm getting the following error on my local web server (Win7 64bit, IIS 7.5).  I've uninstalled & reinstalled IIS locally and it didn't fix it.  IIS is set to start up automatically and I can see that the service has been successfully started.  Upon a fresh reboot if I go into IIS and click on start website I get the following error:

"The process cannot access the file because it is being used by another process.  (Exception from HRESULT:  0x80070020"

If I try to start debugging on my local website project I get the following error:

"Unable to start debugging on the web server.  The underlying connection was closed.  The connection was closed unexpectedly."

Any ideas on what I can try?  I've been doing research on the issue and Microsoft suggest making sure no other service is listening on the same ports.  I've verified that this isn't the issue.


IIS Issues - Unable to start debugging on the web server. The underlying connection was closed. The connection was closed unexpectedly.

  

All of the sudden I'm getting the following error on my local web server (Win7 64bit, IIS 7.5).  I've uninstalled & reinstalled IIS locally and it didn't fix it.  IIS is set to start up automatically and I can see that the service has been successfully started.  Upon a fresh reboot if I go into IIS and click on start website I get the following error:
"The process cannot access the file because it is being used by another process.  (Exception from HRESULT:  0x80070020"
If I try to start debugging on my local website project I get the following error:
"Unable to start debugging on the web server.  The underlying connection was closed.  The connection was closed unexpectedly."
Any ideas on what I can try?  I've been doing research on the issue and Microsoft suggest making sure no other service is listening on the same ports.  I've verified that this isn't the issue.

All of the sudden I'm getting the following error on my local web server (Win7 64bit, IIS 7.5).  I've uninstalled & reinstalled IIS locally and it didn't fix it.  IIS is set to start up automatically and I can see that the service has been successfully started.  Upon a fresh reboot if I go into IIS and click on start website I get the following error:

"The process cannot access the file because it is being used by another process.  (Exception from HRESULT:  0x80070020"

If I try to start debugging on my local website project I get the following error:

"Unable to start debugging on the web server.  The underlying connection was closed.  The connection was closed unexpectedly."

Any ideas on what I can try?  I've been doing research on the issue and Microsoft suggest making sure no other service is listening on the same ports.  I've verified that this isn't the issue.


master page error

  

I'm doing an application which has already contains a master page named Master.master. And all related web forms(Webpage) are running well. But I create another master page in same application named Profile.master for some other web form(Webpage). But this time some of the related pages are running a blank page and some are generating an error that is:-

is not allowed here because it does not extend class 'System.Web.UI.Page'.

please help me to rectify this error.



Vishal Purohit


The remote server returned an error: (403) Forbidden.

  

Hi All,

i have a program in vb.net..i use the webrequest to post the data to another page (http://localpost/posReceived.aspx), and use the webResponse to get the back the response from the remote page.

When i run this program, it returned error "The remote server returned an error: (403) Forbidden.". I have no idea on this. Coz my aspx page and posReceived.aspx are placed in the same server and same directory. I supposed it should be worked without any security concerns.

Can anyone help me to solve it. Thanks a lot!

 

 

 


Error Creating Control

  

I have created a sample Web App. for creating dynamic controls. It worked fine when I originally created it, however after closing the solution and opening a couple days later this is what happens. Any ideas why?

 

Error Creating Control - ScriptManager1, Oject Reference not set to an instance of an object. 

Error Creating Control - Button1, Oject Reference not set to an instance of an object. 

Error Creating Control - UpdatePanel1, Oject Reference not set to an instance of an object.

 

<%@ Page Title="Home Page" Language="vb" MasterPageFile="~/Site.Master" AutoEventWireup="false"
    CodeBehind="Default.aspx.vb" Inherits="WebApplication5._Default" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>

<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
 <asp:Button ID="Button1" runat="server" Text="Button" />
    <div style="text-align: center; float: left; width: 336px;">
        <div style="background-color: Aqua; ">
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <br />
                <asp:PlaceHolder runat="server" id="myPlaceHolder" />
                <br />
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="MyButton" EventName="Click" />
            </Triggers>

            </asp:UpdatePanel>
       </div>
   </div>

   <div style="text-align: center; float: left; width: 336px;">
        <asp:UpdatePanel ID="UpdatePanel2" runat="server">
        <ContentTemplate>
            <asp:Button ID="btnAddTextBox" runat="server" Text="Add Control" OnClick="btnAddTextBox_Click" Width="200" />
            <br /> <br />
            <asp:Button ID="RemoveTextBoxButton" runat="server" Text="Remove Control" OnClick="RemoveTextBoxButton_Click" Width="200" />
            <br /> <br />
            <asp:Button ID="MyButton" runat="server" Text="My Button" Width="200" />
            <br /> <br />
            <asp:Label runat="server" ID="MyLabel"></asp:Label>
        </ContentTemplate>
    </asp:UpdatePanel>
    
</div>

</asp:Content>


 

 

 

 

 


Microsoft JScript runtime error: Sys.ArgumentException: Value must not be null for Controls and Behaviors. Parameter name: element

  

Hello,

I am facing this error 

Microsoft JScript runtime error: Sys.ArgumentException: Value must not be null for Controls and Behaviors.
Parameter name: element

Microsoft JScript runtime error: Sys.ArgumentException: Value must not be null for Controls and Behaviors.

Parameter name: element

while using Ajaxtoolkit ModelPopupextender with listview, actually I am retriving image from database to the listview in VS 2008. 

Can anyone please help me out of this..


error calling webservice using json

  

 I am trying to populate dropdown using json. It calls the webservice method but its not returning any value and get a error code 500.

My code is as

function changeContextKey()
		{
		var servicePath = "http://localhost:3496/ccm/WsWebService.asmx";
		var methodName = "add";
		var useGet = false ;
		var xValue = $get("cboScenario").value;
//		var yValue = "Scenario:8";
//		var zValue = "";
		alert("xValue");
		var params = {x: xValue};
		var userContext = $get ("result");
		var webServiceProxy = new Sys.Net.WebServiceProxy ();
		webServiceProxy .set_timeout(0);
		request = webServiceProxy ._invoke(servicePath ,methodName ,useGet ,params ,onSuccess, onFailure, userContext );
		}
		function onSuccess(result, userContext, methodName)
		
		{
		userContext .innerHtML = "<b><u>" + result + "</b></u>"
		
		
		}
		
		function onFailure(result, userContext, methodName)
		{
		    alert('Ravi');
		
		}

and in webservice we are just calling a method which populate 
 [WebMethod ]
    public DataSet add(string x)
    {

//code for populating using x
return dataset;


     }


follows

 


Getting error using json

  

 I am trying to call webservice method using JSON.

my code is as follows

<script src="jquery-1.3.2.min.js" type ="text/javascript" ></script>
    <script type ="text/javascript" >
    var pageUrl = '<%=ResolveUrl("~/CS.aspx")%>'
function PopulateContinents() {
    $("#<%=ddlCountries.ClientID%>").attr("disabled", "disabled");
    $("#<%=ddlCities.ClientID%>").attr("disabled", "disabled");
    if ($('#<%=ddlContinents.ClientID%>').val() == "0") {
        $('#<%=ddlCountries.ClientID %>').empty().append('<option selected="selected" value="0">Please select</option>');
        $('#<%=ddlCities.ClientID %>').empty().append('<option selected="selected" value="0">Please select</option>');
    }
    else {
        $('#<%=ddlCountries.ClientID %>').empty().append('<option selected="selected" value="0">Loading...</option>');
        $.ajax({
            type: "POST",
            url: "CS.aspx.cs/PopulateCountries",
            data: "()" ,
            contentType: "application/json; charset=utf-8",
            timeout: 10000,
            dataType: "json",
            success: OnCountriesPopulated,
            error: function(xhr) {if (!error) return;
                                    if (xhr.responseText)
                                    {var err = JSON2.parse(xhr.responseText);
                                                                if (err)error(err);
                                                                else error( { Message: "Unknown server error." })} return;},
            failure: function(response) {
                alert(response.d);
            }
        });
    }
}


 

 

But am getting error like this:

<html>
    <head>
        <title>This type of page is not served.</title>
        <style>
         body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} 
         p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
         b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
         H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
         H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
         pre {font-family:"Lucida Console";font-size: .9em}
         .marker {font-weight: bold; color: black;text-decoration: none;}
         .version {color: gray;}
         .error {margin-bottom: 10px;}
         .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
        </style>
    </head>

    <body bgcolor="white">

            <span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1>

            <h2> <i>This type of page is not served.</i> </h2></span>

            <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">

            <b> Description: </b>The type of page you have requested is not served because it has been explicitly forbidden.     Please review the URL below and make sure that it is spelled correctly.
            <br><br>

            <b> Requested URL: </b>/CS.aspx.cs/PopulateCountries<br><br>

            <hr width=100% size=1 color=silver>

            <b>Version Information:</b> Microsoft .NET Framework Version:2.0.50727.1882; ASP.NET Version:2.0.50727.1887

            </font>

    </body>
</html>
<!-- 
[HttpException]: Path '/CS.aspx.cs/PopulateCountries' is forbidden.
   at System.Web.HttpForbiddenHandler.ProcessRequest(HttpContext context)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
-->


 

how to overcome this problem?


Jquery script and IE crashes with the error "Operation Aborted"

  

I have got this script from http://flowplayer.org/tools/demos/overlay/modal-dialog.html and using this overlay to display errors in my application. But when i call this script from code behind I get "Operation Aborted" in IE although it works perfectly in FireFox. Here is the code

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="throw.aspx.cs" Inherits="ElectronicBillPayment._throw" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
<!-- include the Tools -->
	<script src="http://cdn.jquerytools.org/1.2.5/full/jquery.tools.min.js"></script>
	
	<style>
	
	.modal {
		background-color:#fff;
		display:none;
		width:350px;
		padding:15px;
		text-align:left;
		border:2px solid #333;
	
		opacity:0.8;
		-moz-border-radius:6px;
		-webkit-border-radius:6px;
		-moz-box-shadow: 0 0 50px #fff;
		-webkit-box-shadow: 0 0 50px #ccc;
	}
	
	.modal h2 {
		background:url(/img/global/info.png) 0 50% no-repeat;
		margin:0px;
		padding:10px 0 10px 45px;
		border-bottom:1px solid #333;
		font-size:20px;
	}
	</style>
        
  
</head>

<body >
<div class="modal" id="yesno">
	<h2>This is a modal dialog</h2>

	<p>
		You can only interact with elements that are inside this dialog.
		To close it click a button or use the ESC key.
	</p>

	<!-- yes/no buttons -->
	<p>
		<button class="close"> Yes </button>
		<button class="close"> No </button>
	</p>
</div>


<form name="form1" id="form1" runat="server">
<asp:Button ID="Button1" runat="server" Text="Button" 
    onclick="Button1_Click1" />
</form>

      <script type="text/javascript">
          function triggeroverlay() {
              $("#yesno").overlay({
                  // some mask tweaks suitable for modal dialogs
                  mask: {
                      color: '#a2a2a2',
                      loadSpeed: 200,
                      opacity: 0.9
                  },
                  api: true
              }).load();
          }
        </script>
        
<script type ="text/javascript">
    // What is $(document).ready ? See: http://flowplayer.org/tools/documentation/basics.html#document_ready
    $(document).ready(function() {

        var triggers = $(".modalInput").overlay({

            // some mask tweaks suitable for modal dialogs
            mask: {
                color: '#808000',
                loadSpeed: 200,
                opacity: 0.9
            },

            closeOnClick: false
        });


        var buttons = $("#yesno button").click(function(e) {

            // get user input
            var yes = buttons.index(this) === 0;

            // do something with the answer
            triggers.eq(0).html("You clicked " + (yes ? "yes" : "no"));
        });


        $("#prompt form").submit(function(e) {

            // close the overlay
            triggers.eq(1).overlay().close();

            // get user input
            var input = $("input", this).val();

            // do something with the answer
            triggers.eq(1).html(input);

            // do not submit the form
            return e.preventDefault();
        });

    });
</script>

</body>


</html>


Here is the Code behind where i am calling "triggeroverlay" javascript function to display error to the user.

    public partial class _throw : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
          

        }

        protected void Button1_Click1(object sender, EventArgs e)
        {
         ClientScript.RegisterStartupScript(this.GetType(), "throwError", "<script>triggeroverlay();</script>");
        }
    }
}


I was reading this article about the same thing but didn't get it properly. Please help and give example where i am wrong and how to make it work.

http://weblogs.asp.net/infinitiesloop/archive/2006/11/02/Dealing-with-IE-_2600_quot_3B00_Operation-Aborted_2600_quot_3B002E00_-Or_2C00_-how-to-Crash-IE.aspx



There was an error while enumerating services on local machine

  

Hello,

This error never happens before in my machine since 7 months of using it. Sad

"There was an error while enumerating services on local machine:
Active Directory Services cannot find the web server. A possible cause for this is an incompatibility between versions of Internet Information Server (IIS) on the client and the server. Another possible cause is that IIS is not installed on the local machine, or the user identity under which you are running may not have permissions to view websites on this machine. To view websites on this machine, make sure that you run Visual Studio as administrator. On Windows Vista computers with IIS installed, make sure that IIS Metabase and IIS 6 configuration compatibility feature is enabled."


I'm trying to add back a webservice (localhost) after deletion. And suddenly I'm getting the above error.Sad

The error's suggested tip is to install IIS but I did not install IIS since then in my machine because VS2010 built-in server do just fine. Should I install IIS?

I also found this helpful tips but nothing works. Sad

    * Run Visual Studio with elevated administrator permissions
    * Be a member of the "Administrators" group on the local machine
    * Right-click the Visual Studio icon and select the "Run as administrator" option from the context menu


Any help is much appreciated. Thank You.


 
Categories:
.NET
Java
PHP
C/C++/VC++
HTML/XML
SAP
MainFrames
Data Warehousing
Testing
MySQL
SQL Server
Oracle
Javascript/VB Script
Others
Login
 
 
 
 
 Forgot password
 Contact Us   Terms Of use   Share your knowledge