website online

B

Bart Schelkens

Hi,

I've put my first .Net website online (www.polytools.be)
On this site I use a treeview.
When you click on an item in the treeview, a products-page is displayed.
The problem is that sometimes it works and sometimes it doesn't.
On the computer where I developed the website, everything works fine.
Can anyone help me?

Thx in advance.

This is the errormessage :

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

Unspecified error
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.OleDb.OleDbException: Unspecified error

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:


[OleDbException (0x80004005): Unspecified error]
PolytoolsLogic.CategoryMgr.GetList() in
C:\Inetpub\wwwroot\Test\Polytools\PolytoolsLogic\CategoryMgr.vb:41
Polytools.modGlobals.BuildTreeView(TreeView& vTreeview, enuLanguage
venuLanguage) in C:\Inetpub\wwwroot\Test\Polytools\modGlobals.vb:234
Polytools.Products.Page_Load(Object sender, EventArgs e) in
C:\Inetpub\wwwroot\Test\Polytools\Products.aspx.vb:140
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750
 
K

Karl Seguin

God forbid you show us line 41 of PolytoolsLogic\CategoryMgr.vb and those
around it ... ..or just the whole GetList function with any relevant ones...

Karl
 
S

Steven Spits

Bart,
[OleDbException (0x80004005): Unspecified error]

I've had the same error in my .NET site, and I've searched for hours to find
a solution. If you're using an Access database, changing the connection
string might solve your problem:

"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\path\file.mdb;Mode=Share
Deny None;"

If this doesn't solve it, please specify the database you use and post your
connection string.

With kind regards,

Steven

- - -
 
B

Bart Schelkens

Hi Karl,

sorry i didn't notice that the mail didn't include my code (even though i
copied it).

so here's my function GetList and any other function related to it.
in my web.config i added an item that says i'm using an access-database.
Here's the connectionstring :

"provider=microsoft.jet.oledb.4.0;data
source=c:\accounts\polytools\WWW\Data\Polytools.mdb;"


Public Function GetList() As IDataReader

Dim lmyDataMgr As New PolytoolsData.DataConnection()

Dim lrdrData As IDataReader

Try

lrdrData = lmyDataMgr.ListAll("SELECT * FROM tblCategory ORDER BY
NameDutch")

Return lrdrData

Catch ex As Exception

Throw ex

Finally

lmyDataMgr = Nothing

End Try

End Function



Public Function ListAll(ByVal vstrQuery As String, ByVal ParamArray
arrParameters() As String) As IDataReader

Dim lconAdministration As IDbConnection = GetConnection()

Dim lcomAdministration As IDbCommand = lconAdministration.CreateCommand

Try

If arrParameters.Length <> 0 Then

Dim lintCounter As Integer

For lintcounter = 0 To arrParameters.Length - 1

Dim lParameter As IDbDataParameter =
lcomAdministration.CreateParameter

lParameter.ParameterName = "@Parameter" & lintCounter

lParameter.Value = arrParameters(lintCounter)

lcomAdministration.Parameters.Add(lParameter)

Next

End If

lcomAdministration.CommandType = CommandType.Text

lcomAdministration.CommandText = vstrQuery

lconAdministration.Open()

Return lcomAdministration.ExecuteReader

lconAdministration.Close()

lconAdministration = Nothing

Catch ex As Exception

Throw ex

End Try

End Function



Public Function GetConnection() As IDbConnection

Dim lstrSoortDB As String

Try

lstrSoortDB =
System.Configuration.ConfigurationSettings.AppSettings.Item("SoortDataBase")

Select Case lstrSoortDB

Case Is = "access"

Return GetAccessCon()

Case Is = "SQLServer"

Return GetSqlCon()

Case Else

Throw New Exception(lstrSoortDB & " is ongeldig!")

End Select

Catch ex As Exception

Throw ex

End Try

End Function



Private Function GetAccessCon() As OleDbConnection

Try

Return New
OleDbConnection(System.Configuration.ConfigurationSettings.AppSettings.Item("conAcc"))

Catch ex As Exception

Throw ex

End Try

End Function
 
B

Bart Schelkens

Hi Steven,

I don't think that problem is my connectionstring.
Everything on the site comes from a database.
And everything is displayed just fine.
Except that sometimes when i click on the treeview, i get the error.

Here's my connectionstring

"provider=microsoft.jet.oledb.4.0;data
source=c:\accounts\polytools\WWW\Data\Polytools.mdb;"

Steven Spits said:
Bart,
[OleDbException (0x80004005): Unspecified error]

I've had the same error in my .NET site, and I've searched for hours to
find a solution. If you're using an Access database, changing the
connection string might solve your problem:

"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\path\file.mdb;Mode=Share
Deny None;"

If this doesn't solve it, please specify the database you use and post
your connection string.

With kind regards,

Steven

- - -
 
S

Steven Spits

Bart,
I don't think that problem is my connectionstring.
Everything on the site comes from a database.
And everything is displayed just fine.

In my case, everything worked fine on my dev machine, but I got the
0x80004005 occasionaly when moved to production.

Instead of "thinking" it will not solve your problem, why not *TRY* it and
be sure?

Steven

- - -
 
K

Karl Seguin

Bart,
Sorry for my less that kind first email (grumpy this morning :) )

I don't see anything specifically wrong and was able to get this working
(though I did modify it a bit to fit my needs). It's solid code, but here
are two things I noticed - any or none of which might be the reason for the
error.


1-
Instead of doing (you do this a couple of places):
Catch ex as Exception
throw ex

simply do:
Catch ex as Exception
throw

You might get more meaningful error messages...if you want to learn more
about why you shouldn't throw ex, check out this great blog post about it
(http://dotnetguy.techieswithcats.com/archives/004118.shtml)


2 -
Connections won't get closed:
lconAdministration.Open()
Return lcomAdministration.ExecuteReader
lconAdministration.Close() 'won't execute as you are returning

instead do:
try
...
lconAdministration.Open()
Return lcomAdministration.ExecuteReader
catch ...
finally
lconAdministartion.Dispose()


The above will actually cause you errors because you need to connection to
stay open while reading a datareader. SO you can either not close the
connection here and let the higher layers take care of it when you are done
with the datareader, or return a datatable instead.


It won't change anything, but you don't need to set variables to nothing
when you are done with them....

Karl
 
B

Bart Schelkens

Steven,

i've just tried it and got another problem :
it now says that my database is already opened exclusively by another user.
 
B

Bart Schelkens

Karl,

if I understand you correctly there is nothing wrong with my code.
So i could keep my code just as it is and everything should be working just
fine.
 
K

Karl Seguin

You might be hiding a more meaningful error because of the way you are
rethrowing them...simply changing the 3 occurances might reveal the true
cause of your problems and is probably well worth it.

Additionally, not closing your connections or closing them improlery could
certainly lead to exceptions being generated (especially when dealing with
datareaders)...

Karl
 
B

Bart Schelkens

I've changed my Throw EX to just Throw
and the error I get now changes sometimes.

Sometimes I get the error as in my original message and sometimes i get the
message "object not set to an instance ..."

So I guess you would change the datareaders into datatables?
 
K

Karl Seguin

object not set to an instance...I'd need a line # and the corresponding
line..but it basically means you are doing SomeObject.SomeThing where
SomeThing is a method/property but SomeObject is null/nothing. DataReaders
to datatables won't necessarily fix this issue...

Karl
 
B

Bart Schelkens

Steven,

when I changed my connectionstring, this was the error i got :

The Microsoft Jet database engine cannot open the file
'C:\accounts\polytools\WWW\Data\Polytools.mdb'. It is already opened
exclusively by another user, or you need permission to view its data.

so now i can't get to my database anymore.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top