473,387 Members | 1,742 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

website online

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\C ategoryMgr.vb:41
Polytools.modGlobals.BuildTreeView(TreeView& vTreeview, enuLanguage
venuLanguage) in C:\Inetpub\wwwroot\Test\Polytools\modGlobals.vb:23 4
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

--------------------------------------------------------------------------------

Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET
Version:1.1.4322.2032

Nov 18 '05 #1
12 1312
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

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Bart Schelkens" <bs********@hotmail.com> wrote in message
news:eO**************@tk2msftngp13.phx.gbl...
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\C ategoryMgr.vb:41
Polytools.modGlobals.BuildTreeView(TreeView& vTreeview, enuLanguage
venuLanguage) in C:\Inetpub\wwwroot\Test\Polytools\modGlobals.vb:23 4
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

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

Nov 18 '05 #2
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

- - -
Nov 18 '05 #3
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.md b;"
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.AppSett ings.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.Configuration Settings.AppSettings.Item("conAcc"))

Catch ex As Exception

Throw ex

End Try

End Function
Nov 18 '05 #4
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.md b;"

"Steven Spits" <no****@company.com> schreef in bericht
news:e0**************@TK2MSFTNGP11.phx.gbl...
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

- - -

Nov 18 '05 #5
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

- - -
Nov 18 '05 #6
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...s/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
--
MY ASP.Net tutorials
http://www.openmymind.net/
"Bart Schelkens" <bs********@hotmail.com> wrote in message
news:e9**************@TK2MSFTNGP10.phx.gbl...
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.md b;"
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.AppSett ings.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.Configuration Settings.AppSettings.Item(
"conAcc"))
Catch ex As Exception

Throw ex

End Try

End Function

Nov 18 '05 #7
Steven,

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

"Steven Spits" <no****@company.com> schreef in bericht
news:%2****************@TK2MSFTNGP10.phx.gbl...
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

- - -

Nov 18 '05 #8
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.
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
schreef in bericht news:OO**************@TK2MSFTNGP12.phx.gbl...
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...s/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
--
MY ASP.Net tutorials
http://www.openmymind.net/
"Bart Schelkens" <bs********@hotmail.com> wrote in message
news:e9**************@TK2MSFTNGP10.phx.gbl...
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.md b;"
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.AppSett ings.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.Configuration Settings.AppSettings.Item(
"conAcc"))

Catch ex As Exception

Throw ex

End Try

End Function


Nov 18 '05 #9
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

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Bart Schelkens" <bs********@hotmail.com> wrote in message
news:OK**************@TK2MSFTNGP14.phx.gbl...
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.
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
schreef in bericht news:OO**************@TK2MSFTNGP12.phx.gbl...
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...s/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
--
MY ASP.Net tutorials
http://www.openmymind.net/
"Bart Schelkens" <bs********@hotmail.com> wrote in message
news:e9**************@TK2MSFTNGP10.phx.gbl...
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.md b;"
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.AppSett ings.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.Configuration Settings.AppSettings.Item( "conAcc"))

Catch ex As Exception

Throw ex

End Try

End Function



Nov 18 '05 #10
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?

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
schreef in bericht news:%2***************@TK2MSFTNGP10.phx.gbl...
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

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Bart Schelkens" <bs********@hotmail.com> wrote in message
news:OK**************@TK2MSFTNGP14.phx.gbl...
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.
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
schreef in bericht news:OO**************@TK2MSFTNGP12.phx.gbl...
> 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...s/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
>
>
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/
>
>
> "Bart Schelkens" <bs********@hotmail.com> wrote in message
> news:e9**************@TK2MSFTNGP10.phx.gbl...
>> 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.md b;"
>>
>>
>> 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.AppSett ings.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.Configuration Settings.AppSettings.Item( > "conAcc"))
>>
>> Catch ex As Exception
>>
>> Throw ex
>>
>> End Try
>>
>> End Function
>>
>>
>
>



Nov 18 '05 #11
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

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Bart Schelkens" <bs********@hotmail.com> wrote in message
news:uZ**************@TK2MSFTNGP10.phx.gbl...
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?

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
schreef in bericht news:%2***************@TK2MSFTNGP10.phx.gbl...
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

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Bart Schelkens" <bs********@hotmail.com> wrote in message
news:OK**************@TK2MSFTNGP14.phx.gbl...
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.
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
schreef in bericht news:OO**************@TK2MSFTNGP12.phx.gbl...
> 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...s/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
>
>
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/
>
>
> "Bart Schelkens" <bs********@hotmail.com> wrote in message
> news:e9**************@TK2MSFTNGP10.phx.gbl...
>> 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.md b;"
>>
>>
>> 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.AppSett ings.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.Configuration Settings.AppSettings.Item(
> "conAcc"))
>>
>> Catch ex As Exception
>>
>> Throw ex
>>
>> End Try
>>
>> End Function
>>
>>
>
>



Nov 18 '05 #12
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.

"Steven Spits" <no****@company.com> schreef in bericht
news:%2****************@TK2MSFTNGP10.phx.gbl...
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

- - -

Nov 18 '05 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Alexandre Plennevaux | last post by:
hello ! I would like to measure the time a user needs to connect to my website. In other words, to perform a ping between my website and the user's computer. I'm scratching my head as to how...
7
by: Jonathan Wood | last post by:
Greetings, I have extensive programming experience (nearly 20 years) but have yet to write a full-blown Web application. In fact, I have done hardly any server/client/database programming at...
0
by: Shadi Naif | last post by:
I am developing a website contains products that meant to be sold online. The company's location is not supported by Paypal. Is there any way to securely create automated online payment website...
10
by: JP Bless | last post by:
Hi all, I have a database Access/MSDE and would like to have a website so users can search the data and update some records/fields through the website.... And I have high speed internet...
2
by: Patrick | last post by:
Hello I'm asking myself what the best practice is, when publishing a asp.net 2.0 website. So when I precompile the website, to put it online, i get a lot of DLLs and ascx/aspx files. So i put...
6
by: Peter | last post by:
Greetings, I'm having trouble deciding on whether to go with a flat file or DB driven architecture for a wee personal website. I'd like to be able to update HTML files online and this is my only...
4
by: Jigar A. Thakor | last post by:
how to create online shopping website.. ?? any architecture ?? How to design any guidlines ? and what is verisign ?? other secure protection needed ?? i want to develop in C#,Asp.net,Sql Server...
10
by: TS | last post by:
i just noticed the website i created in VS 2005 is running on a different port than the default. I see that it is running on the local web server, and also that the website i created isn't in IIS....
8
by: MarkusJNZ | last post by:
Hi, I need to write some code to ensure that a website is still online. I was just going to write some code (Using System.NET webrequest) to retrieve the HTML from a website and if the length...
3
by: moondaddy | last post by:
What's the preferred (best) way to start a website project in VS 2005? I know of 2 ways and each creates a site differently and has different behavior. Open VS 2005 1) from the start page...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.