Showing posts with label command. Show all posts
Showing posts with label command. Show all posts

Saturday, March 31, 2012

Subprocedure for Oracle's SET DEFINE OFF command

I want to create a procedure in ASP.NET to run the "SET DEFINE OFF" command
in an Oracle database. I tried the following:
Public Shared Sub SetDefineOff()
Dim myconnection As New
OracleConnection(ConfigurationSettings.AppSettings("connectionstring"))
Dim cmdsetdefineoff As New OracleCommand("SET DEFINE OFF", myconnection)
myconnection.Open()
cmdsetdefineoff.ExecuteNonQuery()
myconnection.Close()
End Sub
But I recieve the following error:
Server Error in '/lvbeporgtest' Application.
----
--
ORA-00922: missing or invalid option
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.Data.OracleClient.OracleException: ORA-00922:
missing or invalid option
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.
Stack Trace:
[OracleException: ORA-00922: missing or invalid option
]
System.Data.OracleClient.OracleConnection.CheckError(OciErrorHandle
errorHandle, Int32 rc) +174
System.Data.OracleClient.OracleCommand.Execute(OciHandle statementHandle,
CommandBehavior behavior, Boolean isReader, Boolean needRowid, OciHandle&
rowidDescriptor, ArrayList& refCursorParameterOrdinals) +1919
System.Data.OracleClient.OracleCommand.Execute(OciHandle statementHandle,
CommandBehavior behavior, Boolean needRowid, OciHandle& rowidDescriptor) +32
System.Data.OracleClient.OracleCommand.ExecuteNonQueryInternal(Boolean
needRowid, OciHandle& rowidDescriptor) +170
System.Data.OracleClient.OracleCommand.ExecuteNonQuery() +56
Global.SetDefineOff() in C:\Documents and Settings\Nathan
Sokalski\VSWebCache\www.webdevlccc.com\lvbeporgtest\Global.asax.vb:32
newmin.btnSubmitNotesLink_Click(Object sender, EventArgs e) in
C:\Documents and Settings\Nathan
Sokalski\VSWebCache\[url]www.webdevlccc.com\lvbeporgtest\newmin.aspx.vb:71[/url]
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePo
stBackEvent(String
eventArgument) +57
System.Web.UI.Page. RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1292
----
--
Version Information: Microsoft .NET Framework Version:1.1.4322.2300; ASP.NET
Version:1.1.4322.2300
Can someone tell me what I am doing wrong or what is causing the error and
what I can do to fix it? Thanks.
--
Nathan Sokalski
njsokalski@dotnet.itags.org.hotmail.com
http://www.nathansokalski.com/Hi Nathan,
I am no Oracle expert but I can tell you two things:
1. Your code is fine, you aren't doing anything wrong.
2. "SET DEFINE OFF" is not a SQL command, it is a SQL *Plus command. It
just won't work Oracle has no idea what you mean.
Tim
"Nathan Sokalski" wrote:

> I want to create a procedure in ASP.NET to run the "SET DEFINE OFF" comman
d
> in an Oracle database. I tried the following:
> Public Shared Sub SetDefineOff()
> Dim myconnection As New
> OracleConnection(ConfigurationSettings.AppSettings("connectionstring"))
> Dim cmdsetdefineoff As New OracleCommand("SET DEFINE OFF", myconnection)
> myconnection.Open()
> cmdsetdefineoff.ExecuteNonQuery()
> myconnection.Close()
> End Sub
>
> But I recieve the following error:
> Server Error in '/lvbeporgtest' Application.
> ----
--
> ORA-00922: missing or invalid option
> 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.Data.OracleClient.OracleException: ORA-00922:
> missing or invalid option
> Source Error:
> An unhandled exception was generated during the execution of the
> current web request. Information regarding the origin and location of the
> exception can be identified using the exception stack trace below.
> Stack Trace:
> [OracleException: ORA-00922: missing or invalid option
> ]
> System.Data.OracleClient.OracleConnection.CheckError(OciErrorHandle
> errorHandle, Int32 rc) +174
> System.Data.OracleClient.OracleCommand.Execute(OciHandle statementHandl
e,
> CommandBehavior behavior, Boolean isReader, Boolean needRowid, OciHandle&
> rowidDescriptor, ArrayList& refCursorParameterOrdinals) +1919
> System.Data.OracleClient.OracleCommand.Execute(OciHandle statementHandl
e,
> CommandBehavior behavior, Boolean needRowid, OciHandle& rowidDescriptor) +
32
> System.Data.OracleClient.OracleCommand.ExecuteNonQueryInternal(Boolean
> needRowid, OciHandle& rowidDescriptor) +170
> System.Data.OracleClient.OracleCommand.ExecuteNonQuery() +56
> Global.SetDefineOff() in C:\Documents and Settings\Nathan
> Sokalski\VSWebCache\www.webdevlccc.com\lvbeporgtest\Global.asax.vb:32
> newmin.btnSubmitNotesLink_Click(Object sender, EventArgs e) in
> C:\Documents and Settings\Nathan
> Sokalski\VSWebCache\[url]www.webdevlccc.com\lvbeporgtest\newmin.aspx.vb:71[/url]
> System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
> System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.Ra
isePostBackEvent(String
> eventArgument) +57
> System.Web.UI.Page. RaisePostBackEvent(IPostBackEventHandler
> sourceControl, String eventArgument) +18
> System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
> System.Web.UI.Page.ProcessRequestMain() +1292
>
> ----
--
> Version Information: Microsoft .NET Framework Version:1.1.4322.2300; ASP.N
ET
> Version:1.1.4322.2300
>
> Can someone tell me what I am doing wrong or what is causing the error and
> what I can do to fix it? Thanks.
> --
> Nathan Sokalski
> njsokalski@.hotmail.com
> http://www.nathansokalski.com/
>
>
I would recommend that rather than making this a separate command he
include this line at the beginning of whatever stored procedure on
Oracle that he wants to run.
Sort of like in a SQL procedure where you start with SET ANSI OFF.
timkling wrote:
> Hi Nathan,
> I am no Oracle expert but I can tell you two things:
> 1. Your code is fine, you aren't doing anything wrong.
> 2. "SET DEFINE OFF" is not a SQL command, it is a SQL *Plus command. It
> just won't work Oracle has no idea what you mean.
> Tim
> "Nathan Sokalski" wrote:
>
You might need to wrap the SET DEFINE OFF in a BEGIN/END block:
BEGIN SET DEFINE OFF; END;
I've not used Oracle for a couple of years so the syntax might not be correc
t.
"Nathan Sokalski" wrote:

> I want to create a procedure in ASP.NET to run the "SET DEFINE OFF" comman
d
> in an Oracle database. I tried the following:
> Public Shared Sub SetDefineOff()
> Dim myconnection As New
> OracleConnection(ConfigurationSettings.AppSettings("connectionstring"))
> Dim cmdsetdefineoff As New OracleCommand("SET DEFINE OFF", myconnection)
> myconnection.Open()
> cmdsetdefineoff.ExecuteNonQuery()
> myconnection.Close()
> End Sub
>
> But I recieve the following error:
> Server Error in '/lvbeporgtest' Application.
> ----
--
> ORA-00922: missing or invalid option
> 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.Data.OracleClient.OracleException: ORA-00922:
> missing or invalid option
> Source Error:
> An unhandled exception was generated during the execution of the
> current web request. Information regarding the origin and location of the
> exception can be identified using the exception stack trace below.
> Stack Trace:
> [OracleException: ORA-00922: missing or invalid option
> ]
> System.Data.OracleClient.OracleConnection.CheckError(OciErrorHandle
> errorHandle, Int32 rc) +174
> System.Data.OracleClient.OracleCommand.Execute(OciHandle statementHandl
e,
> CommandBehavior behavior, Boolean isReader, Boolean needRowid, OciHandle&
> rowidDescriptor, ArrayList& refCursorParameterOrdinals) +1919
> System.Data.OracleClient.OracleCommand.Execute(OciHandle statementHandl
e,
> CommandBehavior behavior, Boolean needRowid, OciHandle& rowidDescriptor) +
32
> System.Data.OracleClient.OracleCommand.ExecuteNonQueryInternal(Boolean
> needRowid, OciHandle& rowidDescriptor) +170
> System.Data.OracleClient.OracleCommand.ExecuteNonQuery() +56
> Global.SetDefineOff() in C:\Documents and Settings\Nathan
> Sokalski\VSWebCache\www.webdevlccc.com\lvbeporgtest\Global.asax.vb:32
> newmin.btnSubmitNotesLink_Click(Object sender, EventArgs e) in
> C:\Documents and Settings\Nathan
> Sokalski\VSWebCache\[url]www.webdevlccc.com\lvbeporgtest\newmin.aspx.vb:71[/url]
> System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
> System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.Ra
isePostBackEvent(String
> eventArgument) +57
> System.Web.UI.Page. RaisePostBackEvent(IPostBackEventHandler
> sourceControl, String eventArgument) +18
> System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
> System.Web.UI.Page.ProcessRequestMain() +1292
>
> ----
--
> Version Information: Microsoft .NET Framework Version:1.1.4322.2300; ASP.N
ET
> Version:1.1.4322.2300
>
> Can someone tell me what I am doing wrong or what is causing the error and
> what I can do to fix it? Thanks.
> --
> Nathan Sokalski
> njsokalski@.hotmail.com
> http://www.nathansokalski.com/
>
>

Subprocedure for Oracles SET DEFINE OFF command

I want to create a procedure in ASP.NET to run the "SET DEFINE OFF" command
in an Oracle database. I tried the following:

Public Shared Sub SetDefineOff()

Dim myconnection As New
OracleConnection(ConfigurationSettings.AppSettings ("connectionstring"))

Dim cmdsetdefineoff As New OracleCommand("SET DEFINE OFF", myconnection)

myconnection.Open()

cmdsetdefineoff.ExecuteNonQuery()

myconnection.Close()

End Sub

But I recieve the following error:

Server Error in '/lvbeporgtest' Application.
------------------------

ORA-00922: missing or invalid option
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.Data.OracleClient.OracleException: ORA-00922:
missing or invalid option

Source Error:

An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.

Stack Trace:

[OracleException: ORA-00922: missing or invalid option
]
System.Data.OracleClient.OracleConnection.CheckErr or(OciErrorHandle
errorHandle, Int32 rc) +174
System.Data.OracleClient.OracleCommand.Execute(Oci Handle statementHandle,
CommandBehavior behavior, Boolean isReader, Boolean needRowid, OciHandle&
rowidDescriptor, ArrayList& refCursorParameterOrdinals) +1919
System.Data.OracleClient.OracleCommand.Execute(Oci Handle statementHandle,
CommandBehavior behavior, Boolean needRowid, OciHandle& rowidDescriptor) +32
System.Data.OracleClient.OracleCommand.ExecuteNonQ ueryInternal(Boolean
needRowid, OciHandle& rowidDescriptor) +170
System.Data.OracleClient.OracleCommand.ExecuteNonQ uery() +56
Global.SetDefineOff() in C:\Documents and Settings\Nathan
Sokalski\VSWebCache\http://www.webdevlccc.com\lvbeporgt...obal.asax.vb:32
newsadmin.btnSubmitNotesLink_Click(Object sender, EventArgs e) in
C:\Documents and Settings\Nathan
Sokalski\VSWebCache\http://www.webdevlccc.com\lvbeporgt...in.aspx.vb: 71
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String
eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1292

------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2300; ASP.NET
Version:1.1.4322.2300

Can someone tell me what I am doing wrong or what is causing the error and
what I can do to fix it? Thanks.
--
Nathan Sokalski
njsokalski@dotnet.itags.org.hotmail.com
http://www.nathansokalski.com/Hi Nathan,

I am no Oracle expert but I can tell you two things:

1. Your code is fine, you aren't doing anything wrong.
2. "SET DEFINE OFF" is not a SQL command, it is a SQL *Plus command. It
just won't work Oracle has no idea what you mean.

Tim

"Nathan Sokalski" wrote:

> I want to create a procedure in ASP.NET to run the "SET DEFINE OFF" command
> in an Oracle database. I tried the following:
> Public Shared Sub SetDefineOff()
> Dim myconnection As New
> OracleConnection(ConfigurationSettings.AppSettings ("connectionstring"))
> Dim cmdsetdefineoff As New OracleCommand("SET DEFINE OFF", myconnection)
> myconnection.Open()
> cmdsetdefineoff.ExecuteNonQuery()
> myconnection.Close()
> End Sub
>
> But I recieve the following error:
> Server Error in '/lvbeporgtest' Application.
> ------------------------
> ORA-00922: missing or invalid option
> 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.Data.OracleClient.OracleException: ORA-00922:
> missing or invalid option
> Source Error:
> An unhandled exception was generated during the execution of the
> current web request. Information regarding the origin and location of the
> exception can be identified using the exception stack trace below.
> Stack Trace:
> [OracleException: ORA-00922: missing or invalid option
> ]
> System.Data.OracleClient.OracleConnection.CheckErr or(OciErrorHandle
> errorHandle, Int32 rc) +174
> System.Data.OracleClient.OracleCommand.Execute(Oci Handle statementHandle,
> CommandBehavior behavior, Boolean isReader, Boolean needRowid, OciHandle&
> rowidDescriptor, ArrayList& refCursorParameterOrdinals) +1919
> System.Data.OracleClient.OracleCommand.Execute(Oci Handle statementHandle,
> CommandBehavior behavior, Boolean needRowid, OciHandle& rowidDescriptor) +32
> System.Data.OracleClient.OracleCommand.ExecuteNonQ ueryInternal(Boolean
> needRowid, OciHandle& rowidDescriptor) +170
> System.Data.OracleClient.OracleCommand.ExecuteNonQ uery() +56
> Global.SetDefineOff() in C:\Documents and Settings\Nathan
> Sokalski\VSWebCache\http://www.webdevlccc.com\lvbeporgt...obal.asax.vb:32
> newsadmin.btnSubmitNotesLink_Click(Object sender, EventArgs e) in
> C:\Documents and Settings\Nathan
> Sokalski\VSWebCache\http://www.webdevlccc.com\lvbeporgt...in.aspx.vb: 71
> System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
> System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String
> eventArgument) +57
> System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
> sourceControl, String eventArgument) +18
> System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33
> System.Web.UI.Page.ProcessRequestMain() +1292
>
> ------------------------
> Version Information: Microsoft .NET Framework Version:1.1.4322.2300; ASP.NET
> Version:1.1.4322.2300
>
> Can someone tell me what I am doing wrong or what is causing the error and
> what I can do to fix it? Thanks.
> --
> Nathan Sokalski
> njsokalski@.hotmail.com
> http://www.nathansokalski.com/
>
I would recommend that rather than making this a separate command he
include this line at the beginning of whatever stored procedure on
Oracle that he wants to run.

Sort of like in a SQL procedure where you start with SET ANSI OFF.

timkling wrote:
> Hi Nathan,
> I am no Oracle expert but I can tell you two things:
> 1. Your code is fine, you aren't doing anything wrong.
> 2. "SET DEFINE OFF" is not a SQL command, it is a SQL *Plus command. It
> just won't work Oracle has no idea what you mean.
> Tim
> "Nathan Sokalski" wrote:
>
>>I want to create a procedure in ASP.NET to run the "SET DEFINE OFF" command
>>in an Oracle database. I tried the following:
>>
>>Public Shared Sub SetDefineOff()
>>
>>Dim myconnection As New
>>OracleConnection(ConfigurationSettings.AppSettings ("connectionstring"))
>>
>>Dim cmdsetdefineoff As New OracleCommand("SET DEFINE OFF", myconnection)
>>
>>myconnection.Open()
>>
>>cmdsetdefineoff.ExecuteNonQuery()
>>
>>myconnection.Close()
>>
>>End Sub
>>
>>
>>But I recieve the following error:
>>
>>Server Error in '/lvbeporgtest' Application.
>>------------------------
>>
>>ORA-00922: missing or invalid option
>>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.Data.OracleClient.OracleException: ORA-00922:
>>missing or invalid option
>>
>>Source Error:
>>
>> An unhandled exception was generated during the execution of the
>>current web request. Information regarding the origin and location of the
>>exception can be identified using the exception stack trace below.
>>
>>Stack Trace:
>>
>>[OracleException: ORA-00922: missing or invalid option
>>]
>> System.Data.OracleClient.OracleConnection.CheckErr or(OciErrorHandle
>>errorHandle, Int32 rc) +174
>> System.Data.OracleClient.OracleCommand.Execute(Oci Handle statementHandle,
>>CommandBehavior behavior, Boolean isReader, Boolean needRowid, OciHandle&
>>rowidDescriptor, ArrayList& refCursorParameterOrdinals) +1919
>> System.Data.OracleClient.OracleCommand.Execute(Oci Handle statementHandle,
>>CommandBehavior behavior, Boolean needRowid, OciHandle& rowidDescriptor) +32
>> System.Data.OracleClient.OracleCommand.ExecuteNonQ ueryInternal(Boolean
>>needRowid, OciHandle& rowidDescriptor) +170
>> System.Data.OracleClient.OracleCommand.ExecuteNonQ uery() +56
>> Global.SetDefineOff() in C:\Documents and Settings\Nathan
>>Sokalski\VSWebCache\http://www.webdevlccc.com\lvbeporgt...obal.asax.vb:32
>> newsadmin.btnSubmitNotesLink_Click(Object sender, EventArgs e) in
>>C:\Documents and Settings\Nathan
>>Sokalski\VSWebCache\http://www.webdevlccc.com\lvbeporgt...in.aspx.vb: 71
>> System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
>> System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String
>>eventArgument) +57
>> System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
>>sourceControl, String eventArgument) +18
>> System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33
>> System.Web.UI.Page.ProcessRequestMain() +1292
>>
>>
>>
>>------------------------
>>Version Information: Microsoft .NET Framework Version:1.1.4322.2300; ASP.NET
>>Version:1.1.4322.2300
>>
>>
>>Can someone tell me what I am doing wrong or what is causing the error and
>>what I can do to fix it? Thanks.
>>--
>>Nathan Sokalski
>>njsokalski@.hotmail.com
>>http://www.nathansokalski.com/
>>
>>
>>
You might need to wrap the SET DEFINE OFF in a BEGIN/END block:
BEGIN SET DEFINE OFF; END;

I've not used Oracle for a couple of years so the syntax might not be correct.

"Nathan Sokalski" wrote:

> I want to create a procedure in ASP.NET to run the "SET DEFINE OFF" command
> in an Oracle database. I tried the following:
> Public Shared Sub SetDefineOff()
> Dim myconnection As New
> OracleConnection(ConfigurationSettings.AppSettings ("connectionstring"))
> Dim cmdsetdefineoff As New OracleCommand("SET DEFINE OFF", myconnection)
> myconnection.Open()
> cmdsetdefineoff.ExecuteNonQuery()
> myconnection.Close()
> End Sub
>
> But I recieve the following error:
> Server Error in '/lvbeporgtest' Application.
> ------------------------
> ORA-00922: missing or invalid option
> 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.Data.OracleClient.OracleException: ORA-00922:
> missing or invalid option
> Source Error:
> An unhandled exception was generated during the execution of the
> current web request. Information regarding the origin and location of the
> exception can be identified using the exception stack trace below.
> Stack Trace:
> [OracleException: ORA-00922: missing or invalid option
> ]
> System.Data.OracleClient.OracleConnection.CheckErr or(OciErrorHandle
> errorHandle, Int32 rc) +174
> System.Data.OracleClient.OracleCommand.Execute(Oci Handle statementHandle,
> CommandBehavior behavior, Boolean isReader, Boolean needRowid, OciHandle&
> rowidDescriptor, ArrayList& refCursorParameterOrdinals) +1919
> System.Data.OracleClient.OracleCommand.Execute(Oci Handle statementHandle,
> CommandBehavior behavior, Boolean needRowid, OciHandle& rowidDescriptor) +32
> System.Data.OracleClient.OracleCommand.ExecuteNonQ ueryInternal(Boolean
> needRowid, OciHandle& rowidDescriptor) +170
> System.Data.OracleClient.OracleCommand.ExecuteNonQ uery() +56
> Global.SetDefineOff() in C:\Documents and Settings\Nathan
> Sokalski\VSWebCache\http://www.webdevlccc.com\lvbeporgt...obal.asax.vb:32
> newsadmin.btnSubmitNotesLink_Click(Object sender, EventArgs e) in
> C:\Documents and Settings\Nathan
> Sokalski\VSWebCache\http://www.webdevlccc.com\lvbeporgt...in.aspx.vb: 71
> System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
> System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String
> eventArgument) +57
> System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
> sourceControl, String eventArgument) +18
> System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33
> System.Web.UI.Page.ProcessRequestMain() +1292
>
> ------------------------
> Version Information: Microsoft .NET Framework Version:1.1.4322.2300; ASP.NET
> Version:1.1.4322.2300
>
> Can someone tell me what I am doing wrong or what is causing the error and
> what I can do to fix it? Thanks.
> --
> Nathan Sokalski
> njsokalski@.hotmail.com
> http://www.nathansokalski.com/
>

subst command or maybe network access issue

I'm trying to open an xml document on my computer. It is on a subst drive
f. I get a System.IO.DirectoryNotFoundException when I try to open the
file. When I switch to the C drive it works fine. I gave aspnet user admin
right to make sure it wasn't a permission problem but I am still getting the
exception whatever I do unless I look at my C drive. Any idea what gives?

Thanks guys.
Chris"Chris" <cf@.NoSpamzieQuotepro.com> wrote in
news:e2H7fPO9DHA.2432@.TK2MSFTNGP10.phx.gbl:
> I'm trying to open an xml document on my computer. It is on a subst
> drive f. I get a System.IO.DirectoryNotFoundException when I try to
> open the file. When I switch to the C drive it works fine. I gave
> aspnet user admin right to make sure it wasn't a permission problem but
> I am still getting the exception whatever I do unless I look at my C
> drive. Any idea what gives?

Are the other drives you having trouble with by chance network drives?

--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Thursday, March 22, 2012

suppressing Submit command with a Delete button

I have a Delete button in my datagrid. I'm attempting to add some code
confirming whether the user wishes to really delete the item or not.

The confirm pops up, but I cannot suppress the submission when selecting
Cancel.

Heres what I have so far:

' adding the javascript call to the button:
Private Sub dgItem_ItemCreated(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs) Handles dgItem.ItemCreated

If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType =
ListItemType.AlternatingItem Then

Dim objDeleteButton As Button = CType(e.Item.Cells(1).Controls(0), Button)

objDeleteButton.CssClass = "inputbutton"

objDeleteButton.Attributes.Add("onClick", "confirmDeleteItem();")

End If

End Sub

' client side code in javascript

function confirmDeleteItem()

{

if (confirm("Are you sure you wish to delete this item?"))

{

return true;

}

else

{

return false;

}

}

any help is appreciated. thank you.Sounds like you have validation controls on there, which causes the runtime
to emit yet another onClick handler which submits the form. Try using an
<input type="button"> instead of an <asp:button> control, and if you need
validation just script in the validation call (and, as always, make sure you
explicitly validate on the server, as client side validation is easy to
foil).

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Client
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

"Elliot M. Rodriguez" <elliotmrodriguezatnospamhotmail.com> wrote in message
news:%23xSgcJ$wDHA.2092@.TK2MSFTNGP09.phx.gbl...
> I have a Delete button in my datagrid. I'm attempting to add some code
> confirming whether the user wishes to really delete the item or not.
> The confirm pops up, but I cannot suppress the submission when selecting
> Cancel.
> Heres what I have so far:
> ' adding the javascript call to the button:
> Private Sub dgItem_ItemCreated(ByVal sender As Object, ByVal e As
> System.Web.UI.WebControls.DataGridItemEventArgs) Handles
dgItem.ItemCreated
> If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType =
> ListItemType.AlternatingItem Then
> Dim objDeleteButton As Button = CType(e.Item.Cells(1).Controls(0), Button)
> objDeleteButton.CssClass = "inputbutton"
> objDeleteButton.Attributes.Add("onClick", "confirmDeleteItem();")
> End If
> End Sub
>
> ' client side code in javascript
> function confirmDeleteItem()
> {
> if (confirm("Are you sure you wish to delete this item?"))
> {
> return true;
> }
> else
> {
> return false;
> }
> }
> any help is appreciated. thank you.
Chris:

Thanks for the reply. I am struggling with this.

If I take your approach it seems I dont have the ability to wire it to the
DeleteCommand event. This means I have to access the DataKey for the row
through the client, which I dont want to do. I could be wrong on this
though.

All I really want to do is have a DeleteCommand button that performs a
delete with a confirmation prior to deletion. My code does not have any
other validators on the page. There is another button on the page, but
performs a completely unrelated task.

"Chris Jackson" <chrisjATmvpsDOTorgNOSPAM> wrote in message
news:uV5h$Y$wDHA.3220@.tk2msftngp13.phx.gbl...
> Sounds like you have validation controls on there, which causes the
runtime
> to emit yet another onClick handler which submits the form. Try using an
> <input type="button"> instead of an <asp:button> control, and if you need
> validation just script in the validation call (and, as always, make sure
you
> explicitly validate on the server, as client side validation is easy to
> foil).
> --
> Chris Jackson
> Software Engineer
> Microsoft MVP - Windows Client
> Windows XP Associate Expert
> --
> More people read the newsgroups than read my email.
> Reply to the newsgroup for a faster response.
> (Control-G using Outlook Express)
> --
> "Elliot M. Rodriguez" <elliotmrodriguezatnospamhotmail.com> wrote in
message
> news:%23xSgcJ$wDHA.2092@.TK2MSFTNGP09.phx.gbl...
> > I have a Delete button in my datagrid. I'm attempting to add some code
> > confirming whether the user wishes to really delete the item or not.
> > The confirm pops up, but I cannot suppress the submission when selecting
> > Cancel.
> > Heres what I have so far:
> > ' adding the javascript call to the button:
> > Private Sub dgItem_ItemCreated(ByVal sender As Object, ByVal e As
> > System.Web.UI.WebControls.DataGridItemEventArgs) Handles
> dgItem.ItemCreated
> > If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType =
> > ListItemType.AlternatingItem Then
> > Dim objDeleteButton As Button = CType(e.Item.Cells(1).Controls(0),
Button)
> > objDeleteButton.CssClass = "inputbutton"
> > objDeleteButton.Attributes.Add("onClick", "confirmDeleteItem();")
> > End If
> > End Sub
> > ' client side code in javascript
> > function confirmDeleteItem()
> > {
> > if (confirm("Are you sure you wish to delete this item?"))
> > {
> > return true;
> > }
> > else
> > {
> > return false;
> > }
> > }
> > any help is appreciated. thank you.
Aha - that's a special case I hadn't considered.

Try this article:

http://authors.aspalliance.com/aldo...xamples/cd.aspx

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Client
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

"Elliot M. Rodriguez" <someemail> wrote in message
news:ucDxzLAxDHA.2460@.TK2MSFTNGP10.phx.gbl...
> Chris:
> Thanks for the reply. I am struggling with this.
> If I take your approach it seems I dont have the ability to wire it to the
> DeleteCommand event. This means I have to access the DataKey for the row
> through the client, which I dont want to do. I could be wrong on this
> though.
> All I really want to do is have a DeleteCommand button that performs a
> delete with a confirmation prior to deletion. My code does not have any
> other validators on the page. There is another button on the page, but
> performs a completely unrelated task.
>
> "Chris Jackson" <chrisjATmvpsDOTorgNOSPAM> wrote in message
> news:uV5h$Y$wDHA.3220@.tk2msftngp13.phx.gbl...
> > Sounds like you have validation controls on there, which causes the
> runtime
> > to emit yet another onClick handler which submits the form. Try using an
> > <input type="button"> instead of an <asp:button> control, and if you
need
> > validation just script in the validation call (and, as always, make sure
> you
> > explicitly validate on the server, as client side validation is easy to
> > foil).
> > --
> > Chris Jackson
> > Software Engineer
> > Microsoft MVP - Windows Client
> > Windows XP Associate Expert
> > --
> > More people read the newsgroups than read my email.
> > Reply to the newsgroup for a faster response.
> > (Control-G using Outlook Express)
> > --
> > "Elliot M. Rodriguez" <elliotmrodriguezatnospamhotmail.com> wrote in
> message
> > news:%23xSgcJ$wDHA.2092@.TK2MSFTNGP09.phx.gbl...
> > > I have a Delete button in my datagrid. I'm attempting to add some code
> > > confirming whether the user wishes to really delete the item or not.
> > > > The confirm pops up, but I cannot suppress the submission when
selecting
> > > Cancel.
> > > > Heres what I have so far:
> > > > ' adding the javascript call to the button:
> > > Private Sub dgItem_ItemCreated(ByVal sender As Object, ByVal e As
> > > System.Web.UI.WebControls.DataGridItemEventArgs) Handles
> > dgItem.ItemCreated
> > > > If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType =
> > > ListItemType.AlternatingItem Then
> > > > Dim objDeleteButton As Button = CType(e.Item.Cells(1).Controls(0),
> Button)
> > > > objDeleteButton.CssClass = "inputbutton"
> > > > objDeleteButton.Attributes.Add("onClick", "confirmDeleteItem();")
> > > > End If
> > > > End Sub
> > > > > > ' client side code in javascript
> > > > function confirmDeleteItem()
> > > > {
> > > > if (confirm("Are you sure you wish to delete this item?"))
> > > > {
> > > > return true;
> > > > }
> > > > else
> > > > {
> > > > return false;
> > > > }
> > > > }
> > > > any help is appreciated. thank you.
> >
Chris:

I realized I forgot the lousy "return" keyword in Attributes.Add lol...
Thanks for the article and the help.

"Chris Jackson" <chrisjATmvpsDOTorgNOSPAM> wrote in message
news:OwfPeBBxDHA.1196@.TK2MSFTNGP12.phx.gbl...
> Aha - that's a special case I hadn't considered.
> Try this article:
> http://authors.aspalliance.com/aldo...xamples/cd.aspx
>
> --
> Chris Jackson
> Software Engineer
> Microsoft MVP - Windows Client
> Windows XP Associate Expert
> --
> More people read the newsgroups than read my email.
> Reply to the newsgroup for a faster response.
> (Control-G using Outlook Express)
> --
> "Elliot M. Rodriguez" <someemail> wrote in message
> news:ucDxzLAxDHA.2460@.TK2MSFTNGP10.phx.gbl...
> > Chris:
> > Thanks for the reply. I am struggling with this.
> > If I take your approach it seems I dont have the ability to wire it to
the
> > DeleteCommand event. This means I have to access the DataKey for the row
> > through the client, which I dont want to do. I could be wrong on this
> > though.
> > All I really want to do is have a DeleteCommand button that performs a
> > delete with a confirmation prior to deletion. My code does not have any
> > other validators on the page. There is another button on the page, but
> > performs a completely unrelated task.
> > "Chris Jackson" <chrisjATmvpsDOTorgNOSPAM> wrote in message
> > news:uV5h$Y$wDHA.3220@.tk2msftngp13.phx.gbl...
> > > Sounds like you have validation controls on there, which causes the
> > runtime
> > > to emit yet another onClick handler which submits the form. Try using
an
> > > <input type="button"> instead of an <asp:button> control, and if you
> need
> > > validation just script in the validation call (and, as always, make
sure
> > you
> > > explicitly validate on the server, as client side validation is easy
to
> > > foil).
> > > > --
> > > Chris Jackson
> > > Software Engineer
> > > Microsoft MVP - Windows Client
> > > Windows XP Associate Expert
> > > --
> > > More people read the newsgroups than read my email.
> > > Reply to the newsgroup for a faster response.
> > > (Control-G using Outlook Express)
> > > --
> > > > "Elliot M. Rodriguez" <elliotmrodriguezatnospamhotmail.com> wrote in
> > message
> > > news:%23xSgcJ$wDHA.2092@.TK2MSFTNGP09.phx.gbl...
> > > > I have a Delete button in my datagrid. I'm attempting to add some
code
> > > > confirming whether the user wishes to really delete the item or not.
> > > > > > The confirm pops up, but I cannot suppress the submission when
> selecting
> > > > Cancel.
> > > > > > Heres what I have so far:
> > > > > > ' adding the javascript call to the button:
> > > > Private Sub dgItem_ItemCreated(ByVal sender As Object, ByVal e As
> > > > System.Web.UI.WebControls.DataGridItemEventArgs) Handles
> > > dgItem.ItemCreated
> > > > > > If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType =
> > > > ListItemType.AlternatingItem Then
> > > > > > Dim objDeleteButton As Button = CType(e.Item.Cells(1).Controls(0),
> > Button)
> > > > > > objDeleteButton.CssClass = "inputbutton"
> > > > > > objDeleteButton.Attributes.Add("onClick", "confirmDeleteItem();")
> > > > > > End If
> > > > > > End Sub
> > > > > > > > > > ' client side code in javascript
> > > > > > function confirmDeleteItem()
> > > > > > {
> > > > > > if (confirm("Are you sure you wish to delete this item?"))
> > > > > > {
> > > > > > return true;
> > > > > > }
> > > > > > else
> > > > > > {
> > > > > > return false;
> > > > > > }
> > > > > > }
> > > > > > any help is appreciated. thank you.
> > > > > >