Showing posts with label dll. Show all posts
Showing posts with label dll. Show all posts

Wednesday, March 28, 2012

Trouble converting object to a string using format

Hi all,

I have an object (ie: type Object) which contains a date string like this: 28/04/2004 02:32:52 PM. (This object comes from a legacy COM dll that we use against our database so I can't change this type.)

I want to convert this Object's string to a date in a date format such as "yyyy-MM-dd" which is stored in another string (we get this from the globalisation settings as follows):

_dateFormat = new System.Globalization.CultureInfo(Request.ServerVariables["HTTP_ACCEPT_LANGUAGE"], true).DateTimeFormat.ShortDatePattern.ToString();

So, taking my object with the long date string (remember, it is not a DateTime object) I want to convert it to another string using the format above... so I'd get a string containing "2004-04-28".

Anyone know how I can do this... it should be easy but I can't seem to get it to work.

TIA for any help...

MikeHello,
what don't u use something like this:

( (DateTime)urObject).ToShortDateString();

try it and tell me what happens.
Thanks Haidar... don't why I didn't get that first time around!

Cheers,

Mike
Glad i was able to help you out my friend.

Good Luck.

Saturday, March 24, 2012

Trouble with aspnet_wp.exe

Hello,
I have written a ASP.NET (C#) front-end that connects to an unmanaged win32
c++ dll. A few problems occur:
-I am unable to use the IO stream (write to an event log) from the dll.
Although I can successfully use an IO stream when calling the dll from a
regular .net Windows Form.
-The program behaves very inconsitently. Normally I can connect to my
database (via the unmanaged C++ dll) for the first time only. After this it
will crash everytime UNTIL I restart the aspnet_wp process from the task
manager (at which time I can again connect to the database one time).
This will never be a productive product unless I can get a handle on why I
need to reboot aspnet_wp every 5 minutes.
Has anyone else experienced problems with aspnet_wp.exe?
Thanks!The ASPNET user under which the web application will run will not be able to
write to a file (I assume thats what you are using the stream for) without
explicit access/priveleges to do so. You need to give the ASPNET user enough
permissions to write to the specified directory/file.
As to your database problem, it sounds like the connection is being opened,
then not closed properly and no more connections are being allowed. Perhaps
connection pooling has been disabled? What is your connection string?
- Paul Glavich
Microsoft MVP - ASP.NET
"Akoni" <anthonyjk@.cox.net> wrote in message
news:uXixFo2UEHA.2716@.tk2msftngp13.phx.gbl...
> Hello,
> I have written a ASP.NET (C#) front-end that connects to an unmanaged
win32
> c++ dll. A few problems occur:
> -I am unable to use the IO stream (write to an event log) from the dll.
> Although I can successfully use an IO stream when calling the dll from a
> regular .net Windows Form.
> -The program behaves very inconsitently. Normally I can connect to my
> database (via the unmanaged C++ dll) for the first time only. After this
it
> will crash everytime UNTIL I restart the aspnet_wp process from the task
> manager (at which time I can again connect to the database one time).
> This will never be a productive product unless I can get a handle on why I
> need to reboot aspnet_wp every 5 minutes.
> Has anyone else experienced problems with aspnet_wp.exe?
> Thanks!
>
Thanks Paul,
Your saying that my ASPNET account has read-only privileges to my file
system? How would I go about changing the privileges of the ASPNET account?
I am actually using a Versant database (C++ Object-Oriented
database...non-.NET compliant) on the back-end. Since it does not support
.NET objects, I have to use an unmanaged non-COM C++ DLL to access and stor
e
to it (via marshalling from c# to the unmanaged c++). The problem is that I
get very strange and inconsistent behavior.
I can actually connect to the database and even interact with it for a
period of time. Eventually though, every call to the unmanaged code causes
some generic error message to pop up...even upon rebooting the app! That is,
until I reboot aspnet_wp...which seems to clear "everything" out.
Thanks for your help.
"Paul Glavich [MVP - ASP.NET]" <glav@.aspalliance.com-NOSPAM> wrote in
message news:esV6PU6UEHA.2408@.tk2msftngp13.phx.gbl...
> The ASPNET user under which the web application will run will not be able
to
> write to a file (I assume thats what you are using the stream for) without
> explicit access/priveleges to do so. You need to give the ASPNET user
enough
> permissions to write to the specified directory/file.
> As to your database problem, it sounds like the connection is being
opened,
> then not closed properly and no more connections are being allowed.
Perhaps
> connection pooling has been disabled? What is your connection string?
> --
> - Paul Glavich
> Microsoft MVP - ASP.NET
>
> "Akoni" <anthonyjk@.cox.net> wrote in message
> news:uXixFo2UEHA.2716@.tk2msftngp13.phx.gbl...
> win32
> it
I
>

Trouble with aspnet_wp.exe

Hello,

I have written a ASP.NET (C#) front-end that connects to an unmanaged win32
c++ dll. A few problems occur:

-I am unable to use the IO stream (write to an event log) from the dll.
Although I can successfully use an IO stream when calling the dll from a
regular .net Windows Form.

-The program behaves very inconsitently. Normally I can connect to my
database (via the unmanaged C++ dll) for the first time only. After this it
will crash everytime UNTIL I restart the aspnet_wp process from the task
manager (at which time I can again connect to the database one time).

This will never be a productive product unless I can get a handle on why I
need to reboot aspnet_wp every 5 minutes.

Has anyone else experienced problems with aspnet_wp.exe?

Thanks!The ASPNET user under which the web application will run will not be able to
write to a file (I assume thats what you are using the stream for) without
explicit access/priveleges to do so. You need to give the ASPNET user enough
permissions to write to the specified directory/file.

As to your database problem, it sounds like the connection is being opened,
then not closed properly and no more connections are being allowed. Perhaps
connection pooling has been disabled? What is your connection string?

--
- Paul Glavich
Microsoft MVP - ASP.NET

"Akoni" <anthonyjk@.cox.net> wrote in message
news:uXixFo2UEHA.2716@.tk2msftngp13.phx.gbl...
> Hello,
> I have written a ASP.NET (C#) front-end that connects to an unmanaged
win32
> c++ dll. A few problems occur:
> -I am unable to use the IO stream (write to an event log) from the dll.
> Although I can successfully use an IO stream when calling the dll from a
> regular .net Windows Form.
> -The program behaves very inconsitently. Normally I can connect to my
> database (via the unmanaged C++ dll) for the first time only. After this
it
> will crash everytime UNTIL I restart the aspnet_wp process from the task
> manager (at which time I can again connect to the database one time).
> This will never be a productive product unless I can get a handle on why I
> need to reboot aspnet_wp every 5 minutes.
> Has anyone else experienced problems with aspnet_wp.exe?
> Thanks!
Thanks Paul,

Your saying that my ASPNET account has read-only privileges to my file
system? How would I go about changing the privileges of the ASPNET account?

I am actually using a Versant database (C++ Object-Oriented
database...non-.NET compliant) on the back-end. Since it does not support
..NET objects, I have to use an unmanaged non-COM C++ DLL to access and store
to it (via marshalling from c# to the unmanaged c++). The problem is that I
get very strange and inconsistent behavior.

I can actually connect to the database and even interact with it for a
period of time. Eventually though, every call to the unmanaged code causes
some generic error message to pop up...even upon rebooting the app! That is,
until I reboot aspnet_wp...which seems to clear "everything" out.

Thanks for your help.

"Paul Glavich [MVP - ASP.NET]" <glav@.aspalliance.com-NOSPAM> wrote in
message news:esV6PU6UEHA.2408@.tk2msftngp13.phx.gbl...
> The ASPNET user under which the web application will run will not be able
to
> write to a file (I assume thats what you are using the stream for) without
> explicit access/priveleges to do so. You need to give the ASPNET user
enough
> permissions to write to the specified directory/file.
> As to your database problem, it sounds like the connection is being
opened,
> then not closed properly and no more connections are being allowed.
Perhaps
> connection pooling has been disabled? What is your connection string?
> --
> - Paul Glavich
> Microsoft MVP - ASP.NET
>
> "Akoni" <anthonyjk@.cox.net> wrote in message
> news:uXixFo2UEHA.2716@.tk2msftngp13.phx.gbl...
> > Hello,
> > I have written a ASP.NET (C#) front-end that connects to an unmanaged
> win32
> > c++ dll. A few problems occur:
> > -I am unable to use the IO stream (write to an event log) from the dll.
> > Although I can successfully use an IO stream when calling the dll from a
> > regular .net Windows Form.
> > -The program behaves very inconsitently. Normally I can connect to my
> > database (via the unmanaged C++ dll) for the first time only. After this
> it
> > will crash everytime UNTIL I restart the aspnet_wp process from the task
> > manager (at which time I can again connect to the database one time).
> > This will never be a productive product unless I can get a handle on why
I
> > need to reboot aspnet_wp every 5 minutes.
> > Has anyone else experienced problems with aspnet_wp.exe?
> > Thanks!

Tuesday, March 13, 2012

troubleshooting conflicting DLL references.

Here's the scenario:
We've purchased DTSearch search engine.
It ships with a .net api dll that we can add to our project.
Adding this DLL as a new reference, however, kills my project and spits out
a seemingly irrelevant error:
----
C:\Inetpub\wwwroot\userControls\cioPosti
ngDisplay.ascx.vb(58) : error
BC30392: 'Catch' cannot catch type 'exception' because it is not
'System.Exception' or a class that inherits from 'System.Exception'.
C:\Inetpub\wwwroot\userControls\staticCo
ntentDisplay.ascx.vb(106) : error
BC30392: 'Catch' cannot catch type 'exception' because it is not
'System.Exception' or a class that inherits from 'System.Exception'.
C:\Inetpub\wwwroot\userControls\staticCo
ntentDisplay.ascx.vb(108) : error
BC30456: 'Message' is not a member of 'exception'.
C:\Inetpub\wwwroot\userControls\staticCo
ntentDisplay.ascx.vb(108) : error
BC30456: 'Source' is not a member of 'exception'.
----
What are things that could possibly cause this? The vendor (rightfully so)
finds this behavior odd...as do I.
-DarrelIt looks pretty clear to me:
error BC30392: 'Catch' cannot catch type 'exception' because it is not
'System.Exception' or a class that inherits from 'System.Exception'.
Your catch needs to be:
Try
' ... code
Catch(exception As System.Exception)
' ... code
Finally
' ... code
EndCatch
The remaining errors are because you're attempting to access member
properties and methods of System.Exception from a class that isn't derived
from System.Exception. Once you fix your catch statement, the rest ought to
work.
"darrel" wrote:

> Here's the scenario:
> We've purchased DTSearch search engine.
> It ships with a .net api dll that we can add to our project.
> Adding this DLL as a new reference, however, kills my project and spits ou
t
> a seemingly irrelevant error:
> ----
> C:\Inetpub\wwwroot\userControls\cioPosti
ngDisplay.ascx.vb(58) : error
> BC30392: 'Catch' cannot catch type 'exception' because it is not
> 'System.Exception' or a class that inherits from 'System.Exception'.
> C:\Inetpub\wwwroot\userControls\staticCo
ntentDisplay.ascx.vb(106) : error
> BC30392: 'Catch' cannot catch type 'exception' because it is not
> 'System.Exception' or a class that inherits from 'System.Exception'.
> C:\Inetpub\wwwroot\userControls\staticCo
ntentDisplay.ascx.vb(108) : error
> BC30456: 'Message' is not a member of 'exception'.
> C:\Inetpub\wwwroot\userControls\staticCo
ntentDisplay.ascx.vb(108) : error
> BC30456: 'Source' is not a member of 'exception'.
> ----
> What are things that could possibly cause this? The vendor (rightfully so)
> finds this behavior odd...as do I.
> -Darrel
>
>

> Here's the scenario:
> a seemingly irrelevant error:
> ----
> C:\Inetpub\wwwroot\userControls\cioPosti
ngDisplay.ascx.vb(58) : error
> BC30392: 'Catch' cannot catch type 'exception' because it is not
> 'System.Exception' or a class that inherits from 'System.Exception'.
> C:\Inetpub\wwwroot\userControls\staticCo
ntentDisplay.ascx.vb(106) : error
> BC30392: 'Catch' cannot catch type 'exception' because it is not
> 'System.Exception' or a class that inherits from 'System.Exception'.
> C:\Inetpub\wwwroot\userControls\staticCo
ntentDisplay.ascx.vb(108) : error
> BC30456: 'Message' is not a member of 'exception'.
> C:\Inetpub\wwwroot\userControls\staticCo
ntentDisplay.ascx.vb(108) : error
> BC30456: 'Source' is not a member of 'exception'.
> ----
> finds this behavior odd...as do I.
bit late, but first use system.exception instead of plain exception.
if u use Crystal Reports btw, there is your possible problem.
it uses also Exception, dunno why, but they do it
User submitted from AEWNET (http://www.aewnet.com/)

troubleshooting conflicting DLL references.

Here's the scenario:

We've purchased DTSearch search engine.

It ships with a .net api dll that we can add to our project.

Adding this DLL as a new reference, however, kills my project and spits out
a seemingly irrelevant error:
-----------------
C:\Inetpub\wwwroot\userControls\cioPostingDisplay. ascx.vb(58) : error
BC30392: 'Catch' cannot catch type 'exception' because it is not
'System.Exception' or a class that inherits from 'System.Exception'.
C:\Inetpub\wwwroot\userControls\staticContentDispl ay.ascx.vb(106) : error
BC30392: 'Catch' cannot catch type 'exception' because it is not
'System.Exception' or a class that inherits from 'System.Exception'.
C:\Inetpub\wwwroot\userControls\staticContentDispl ay.ascx.vb(108) : error
BC30456: 'Message' is not a member of 'exception'.
C:\Inetpub\wwwroot\userControls\staticContentDispl ay.ascx.vb(108) : error
BC30456: 'Source' is not a member of 'exception'.
-----------------

What are things that could possibly cause this? The vendor (rightfully so)
finds this behavior odd...as do I.

-DarrelIt looks pretty clear to me:
error BC30392: 'Catch' cannot catch type 'exception' because it is not
'System.Exception' or a class that inherits from 'System.Exception'.

Your catch needs to be:
Try
' ... code
Catch(exception As System.Exception)
' ... code
Finally
' ... code
EndCatch

The remaining errors are because you're attempting to access member
properties and methods of System.Exception from a class that isn't derived
from System.Exception. Once you fix your catch statement, the rest ought to
work.

"darrel" wrote:

> Here's the scenario:
> We've purchased DTSearch search engine.
> It ships with a .net api dll that we can add to our project.
> Adding this DLL as a new reference, however, kills my project and spits out
> a seemingly irrelevant error:
> -----------------
> C:\Inetpub\wwwroot\userControls\cioPostingDisplay. ascx.vb(58) : error
> BC30392: 'Catch' cannot catch type 'exception' because it is not
> 'System.Exception' or a class that inherits from 'System.Exception'.
> C:\Inetpub\wwwroot\userControls\staticContentDispl ay.ascx.vb(106) : error
> BC30392: 'Catch' cannot catch type 'exception' because it is not
> 'System.Exception' or a class that inherits from 'System.Exception'.
> C:\Inetpub\wwwroot\userControls\staticContentDispl ay.ascx.vb(108) : error
> BC30456: 'Message' is not a member of 'exception'.
> C:\Inetpub\wwwroot\userControls\staticContentDispl ay.ascx.vb(108) : error
> BC30456: 'Source' is not a member of 'exception'.
> -----------------
> What are things that could possibly cause this? The vendor (rightfully so)
> finds this behavior odd...as do I.
> -Darrel
>

> Here's the scenario:
> > We've purchased DTSearch search engine.
> > It ships with a .net api dll that we can add to our project.
> > Adding this DLL as a new reference, however, kills my project and spits out
> a seemingly irrelevant error:
> -----------------
> C:\Inetpub\wwwroot\userControls\cioPostingDisplay. ascx.vb(58) : error
> BC30392: 'Catch' cannot catch type 'exception' because it is not
> 'System.Exception' or a class that inherits from 'System.Exception'.
> C:\Inetpub\wwwroot\userControls\staticContentDispl ay.ascx.vb(106) : error
> BC30392: 'Catch' cannot catch type 'exception' because it is not
> 'System.Exception' or a class that inherits from 'System.Exception'.
> C:\Inetpub\wwwroot\userControls\staticContentDispl ay.ascx.vb(108) : error
> BC30456: 'Message' is not a member of 'exception'.
> C:\Inetpub\wwwroot\userControls\staticContentDispl ay.ascx.vb(108) : error
> BC30456: 'Source' is not a member of 'exception'.
> -----------------
> > What are things that could possibly cause this? The vendor (rightfully so)
> finds this behavior odd...as do I.
> > -Darrel

bit late, but first use system.exception instead of plain exception.

if u use Crystal Reports btw, there is your possible problem.
it uses also Exception, dunno why, but they do it

User submitted from AEWNET (http://www.aewnet.com/)