469,887 Members | 1,201 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,887 developers. It's quick & easy.

Deleting row from asp.net grid - "Connection must valid and open" error?

I get the following error. Apart from the fact that it does not make any
grammatical sense, what would be likely to be causing it?

I have a command component 'nxCmdDeleteErrorLogItem' with the following SQL:

Delete from ErrorLog where LogID = ?

LogID is a parameter corresponding to a DB field LogID which is an autoinc
field (the parameter is set at Int32).

I know the connection is ok (it works in the rest of the code, the only
problem occurs when I try to do this delete).


Lauchlan M


Server Error in '/MyWebInterface_NexusDB' Application.

Connection must valid and open
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Connection must valid
and open

Source Error:

Line 351: nxCmdDeleteErrorLogItem.Parameters["LogID"].Value =
Line 352: nxConnection.Open();
Line 353: nxCmdDeleteErrorLogItem.ExecuteNonQuery(); // error occurs here
Line 354: nxConnection.Close();

Source File:
e:\inetpub\wwwroot\Mywebinterface_nexusdb\admin\vi ewerrorlog.aspx.cs
Line: 353

Stack Trace:

[InvalidOperationException: Connection must valid and open]

MyWebInterface_NexusDB.Admin.ViewErrorLog.dGridErr orLog_DeleteCommand(Object
source, DataGridCommandEventArgs e) in
e:\inetpub\wwwroot\Mywebinterface_nexusdb\admin\vi ewerrorlog.aspx.cs:353

System.Web.UI.WebControls.DataGrid.OnDeleteCommand (DataGridCommandEventArgs
e) +110
System.Web.UI.WebControls.DataGrid.OnBubbleEvent(O bject source, EventArgs
e) +589
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +26
System.Web.UI.WebControls.DataGridItem.OnBubbleEve nt(Object source,
EventArgs e) +106
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +26
System.Web.UI.WebControls.LinkButton.OnCommand(Com mandEventArgs e) +121

System.Web.UI.WebControls.LinkButton.System.Web.UI .IPostBackEventHandler.Rai
sePostBackEvent(String eventArgument) +115
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +138
System.Web.UI.Page.ProcessRequestMain() +1277

Nov 18 '05 #1
1 1243


Lauchlan M
Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Özden Irmak | last post: by
3 posts views Thread by =?Utf-8?B?UGF1bCBQcmV3ZXR0?= | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.