|
I am getting the message "Thread was being aborted" when I do a response.redirect in the code.
My code is:
If A=1 Then
Response.Redirect("url")
Anyone any ideas why I a getting this?
|
|
|
|
|
You might want to try the ASP.NET[^] Forum for this question...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am trying to get an orderId back from my table and could not. I create a stored procedure did not work. I use the select statement with where clause and did not work as well. Could someone help. Here is my code in stored procedure and select statement.
====================================================
CREATE PROCEDURE proc_getID
(@OrderId int out,
@CustomerName varchar(50)
)
As
SELECT @OrderId, @CustomerName FROM Orders WHERE Orders.CustomerName = @CustomerName
GO
==================================================================
Dim ConnStr As String
Dim SQL As String
ConnStr = "server=(local);database=Orders;uid=sa;pwd="
Dim MySqlConn As New SqlConnection(ConnStr)
MySqlConn.Open()
'''''''''''''''''''''''''''''''''''''''''''''''''
'''' I used select statement here '''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''
Dim myCommand As New SqlCommand("SELECT @OrderId ,@CustomerName FROM Orders WHERE CustomerName = @CustomerName", MySqlConn)
myCommand.Parameters.Add(New SqlParameter("@OrderId", SqlDbType.Int))
myCommand.Parameters.Add(New SqlParameter("@CustomerName", SqlDbType.VarChar, 50))
myCommand.Parameters("@CustomerName").Direction = ParameterDirection.Input
myCommand.Parameters("@CustomerName").Value = "steve"
myCommand.Parameters("@OrderId").Direction = ParameterDirection.Output
Dim eCount As Integer
eCount = 0
myCommand.ExecuteNonQuery()
eCount = CInt(myCommand.Parameters("@OrderId").Value)
TextBox4.Text = eCount.ToString
=========================================================================
===== I used stored procedure here =============
=================================================
'Dim cmdAuthor As New SqlCommand("proc_getID", MySqlConn)
'cmdAuthor.CommandType = CommandType.StoredProcedure
'cmdAuthor.Parameters.Add(New SqlParameter("@OrderId", SqlDbType.Int))
'cmdAuthor.Parameters.Add(New SqlParameter("@CustomerName", SqlDbType.VarChar, 50))
'cmdAuthor.Parameters("@CustomerName").Direction = ParameterDirection.Input
'cmdAuthor.Parameters("@CustomerName").Value = "steve"
'cmdAuthor.Parameters("@OrderId").Direction = ParameterDirection.Output
'Dim eCount As Integer
'eCount = 0
'cmdAuthor.ExecuteNonQuery()
''eCount = CInt(cmdAuthor.Parameters("@OrderId").Value)
'If cmdAuthor.Parameters("@OrderId").Value Is DBNull.Value Then
' '' The stored procedure returned a NULL output parameter
' eCount = -12345
' TextBox4.Text = eCount.ToString()
'Else
' eCount = cmdAuthor.Parameters("@OrderId").Value
' TextBox4.Text = eCount.ToString()
'End If
'TextBox4.Text = eCount.ToString()
MySqlConn.Close()
End Sub
|
|
|
|
|
Try wrapping your assignment line in a Try/Catch block...
Try
eCount = CInt(myCommand.Parameters("@OrderId").Value)
Catch ex As Exception
' -1 will signify an invalid OrderID...
eCount = -1
End Try
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
You can use a Try Catch block to trap this exception, and as a matter of principle all database operations should have error handling because they can fail for numerous reasons.
However, a stored procedure returning a Null value is not always a true error, and it is best to test for this condition. You should test for the DBNull condition BEFORE you attempt to assign the return parameter value to an integer. This will allow you to trap the null before your code raises an invalid cast error.
Change your code to:
If IsDBNull(cmdAuthor.Parameters("@OrderID").Value) Then
eCount = -12345
Else
eCount = CInt(cmdAuthor.Parameters("@OrderID").Value)
End If
Robert
|
|
|
|
|
Hi
Iam using Ngen tool to speed up my application my .net framework version is 1.1. Iam using it like this.
Ngen and my assembly name on Dos prompt.My assenply means the exe file and dll which are in bin directory
d:\>foldername\bin>ngen assemly name with my two dll
Is it sufficeient to do to cache or ihave to do more because there is no effect on my app. performance
Please help with solution
Regards
Prashant
|
|
|
|
|
Of course is doesn't speed up your application. All NGen does is convert the IL code that's in the assemblies you specified into native processor code. It doesn't do any caching at all and will NOT speed up your application's startup time.
Do you have a startup form with ALOT of controls on it perhaps???
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Never heard of the problem.
Since we know nothing of what your forms are doing on load, what they look like, what the code looks like, ..., there's nothing we can do to help you. You have to provide A LOT more information about your forms and their code for anyone to help.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello,
I have a class in my web application that is used to connect to the database and submit or gain data from my tables.
The class is called dataAccess and is as follow:
Public Class DataAccess
Private Function Connect() As SqlClient.SqlConnection
Try
myConnection = New SqlClient.SqlConnection
myConnection.ConnectionString = myConnectionString
myConnection.Open()
Return myConnection
Catch ex As Exception
'Database Cannot be reached
Return Nothing
End Try
End Function
Protected Friend Function alertDatabase(ByVal myQuery As String) As Boolean
Dim myCommand As SqlClient.SqlCommand
Try
'Application.Lock()
myCommand = New SqlClient.SqlCommand(myQuery, Connect())
myCommand.ExecuteNonQuery()
DisConnect()
'Application.UNLock()
Return True
Catch ex As Exception
DisConnect()
Return False
End Try
End Function
End Class
At Application.Lock() my compiler says that namespace is not declare!!!
how can i solve this problem? Can i declare the application?
Thanks in advance,
Kakomalis
|
|
|
|
|
I'm guessing that this is a seperate class file from your ASP web form. Try adding Imports System.Web to the top of your DataAccess class file.
BTW: Your data layer classes, properly written, shouldn't care about what type of application is using them. Your code is using a web application Lock method where it shouldn't have to. The data layer should never have this kind of dependancy.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am using mapi controls to send emails automatically to the clients.I can send the mails but it always prompts to send message .how do i stop it
smita
|
|
|
|
|
You have to go into Outlook Express, click on the Tools Menu, click Options..., then click on the Security tab. Uncheck "Warn me when other applications try to send mail as me."
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
I have written a stored procedure in SQL Server which uses temp tables and returns the rows of a temptable.
When i try to use this sp as datasource for Crystal report(Add Database), the fields are not listed.
Why is that? If this wouldnt work how do i implement this.
Am using a custom version of crystal report bundled in VS .NET.
Any help would be appreciated.
Geetha
|
|
|
|
|
Hello there
I have built a setup for the project. in which I included couple of image files to be displayed when user will run the setup. I want those files to be deleted after the installation is completed.
can any one tell me how ?
|
|
|
|
|
How exactly are you originally installing and displaying these images? If you add an image to a setup dialog, it can be embedded in the MSI itself, and does not need to be "installed". You can also add a custom action to delete the image files at the end of the setup, however if the image files are originally installed by the MSI itself, you must be careful how the atributes of the files are set, because deleting a file that is marked as required will trigger a repair to run automatically.
Robert
|
|
|
|
|
well thanks for both the replies. in this scenario I am putting the image on SetupDialog. But the problem is when I click browse to assign the image to a dialog page it asks me the location of file according to the project... means file in Application Folder or User Desktop... etc. the folders exist in the project. so if the file is not there then you cannot assign. and if I add the files in application folder then it remains there after setup runs..
|
|
|
|
|
In order of easiest to hardest, also in order of least elegant to most elegant solutions:
1) You can just leave them, a couple of image files are no big deal.
2) You can write a custom action to delete them at the end of the setup. See MSDN for creating custom actions. Test it to make sure it does not triggera reinstall. If it does you need to adjust the file attributes.
3) If you have Orca you can do a lot of things not supported by VS IDE. By manually editing the msi package, you can embed each image as a binary stream, and you can set the dialog properties to display the image in the particular dialog by loading it from the msi itself rather than fropm a disk. This is not exactly hard to do, but it is not trivial either.
Depends on how much effort you want to put into the problem.
Robert
|
|
|
|
|
Please don't do number 1. There is nothing I hate more than installers that leave temp stuff used only during installation on my computer when they finish. Therefore, I'm glad to hear that you are looking for a solution to get rid of them.
Brian Van Beek
My Blog is Awesome, ok maybe not, but is still fun!!
|
|
|
|
|
Thanks for the solutions. I am going for solution 2 and 3 to test both. as far the point 3 is concerned I have seen your article as well. good job. I found the URL for orca over there but it says that page has been moved and then they moved me to page
http://www.microsoft.com/downloads/details.aspx?FamilyId=A55B6B43-E24F-4EA3-A93E-40C0EC4F68E5&displaylang=en[^]
which doesnt look orca. I have searched at google and it took me to same place. Can you just check and confirm the url so that I can download the right thing.
thanks alot for the support
|
|
|
|
|
Yes, it is the correct link. They call oit the Platform SDK, but it includes the Windows Installer SDK. Let me know if you have problems once you start working with Orca.
Robert
|
|
|
|
|
well Robert I was trying to download it but it is of 370 MB + so will take time. secondly I need to install windows 2003 server and I have winXP professional. so it will take time to do so.
thanks for the support. I might bother you after some time when I shall have the required settings for this.
|
|
|
|
|
I am making a tile view control, but have a couple of snags. I am using a custom control for the tile and adding it to a panel control. I have made a semi transparent control to act as a selection box. Problem is that the selection box doesn't paint over the controls that are added to my user control..ie pic box and leabels. I looked at trying to inherit the listview control and make my own items, but haven't found much to help with the problem. Any ideas?
TIA
|
|
|
|
|
Hi all programmers,
I need a code which converts the XML file to Excel file. I have xml file and a xsl file is related to xml file.
Please help me with it.
Regards, all
|
|
|
|
|
There're two forms running on the MDI Form. From 1 form, how can we process another one?
Thanks!
|
|
|
|
|
<font color=blue>Dim</font> Frm As Form2
Frm = <font color=blue>New</font> Form2( <font color=green>set constructor parameters here</font> )
Frm.ShowDialog() <font color=green>' if you want it modal...</font>
Frm.Show() <font color=green>' Non Modal child frame...</font>
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|