DeveloperBarn Forums

DeveloperBarn

Programming & IT forum

Cannot find server error

This is a discussion on Cannot find server error within the .Net Development forums, part of the Programming & Scripting category; I have just uploaded a new page to my app, but when I try and navigate to it, I get ...

Go Back   DeveloperBarn Forums > Programming & Scripting > .Net Development

  #1  
Old November 25th, 2008, 10:28 AM
richyrich's Avatar
Administrator
 
Join Date: Mar 2008
Real name: Rich
Location: Somewhere only we know...
Posts: 1,342
Blog Entries: 6
Rep Power: 8
richyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to all
Default Cannot find server error

I have just uploaded a new page to my app, but when I try and navigate to it, I get a "Cannot find server" error.

All the other pages in the app seem to be working fine.

I presume that there is a problem in my code, but it's not throwing an exception.

Any ideas what might be causing this error to occur?
Reply With Quote
  #2  
Old November 25th, 2008, 11:45 AM
richyrich's Avatar
Administrator
 
Join Date: Mar 2008
Real name: Rich
Location: Somewhere only we know...
Posts: 1,342
Blog Entries: 6
Rep Power: 8
richyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to all
Default

OK. I think I have located the source of the problem.

Have a problem with a couple of functions in my DAL. Just need to isolate what the problem is now.
Reply With Quote
  #3  
Old November 25th, 2008, 12:48 PM
richyrich's Avatar
Administrator
 
Join Date: Mar 2008
Real name: Rich
Location: Somewhere only we know...
Posts: 1,342
Blog Entries: 6
Rep Power: 8
richyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to all
Default

OK, I just cannot see what the problem is with this code. If I run it, it causes a "Cannot find server" error. It's absolutely doing my head in.

.aspx.vb
asp Code:
  1. Sub build_marital_status()
  2.      ddl_marital1.DataSource = SiteBLL.GetMaritalStatusList()
  3.      ddl_marital1.DataValueField = "ref"
  4.      ddl_marital1.DataTextField = "type"
  5.      ddl_marital1.DataBind()
  6. End Sub

BOL
asp Code:
  1. Public Class MaritalList
  2.      Inherits List(Of MaritalType)
  3.      Public Sub New()
  4.      End Sub
  5.  
  6.      Private _page_error As String = String.Empty
  7.      Public Property page_error() As String
  8.         Get
  9.            Return _page_error
  10.         End Get
  11.         Set(ByVal value As String)
  12.            _page_error = value
  13.         End Set
  14.       End Property
  15. End Class
  16.  
  17. Public Class MaritalType
  18.       Public Sub New(ByVal p_ref As String, ByVal p_type As String)
  19.            ref = p_ref
  20.            type = p_type
  21.       End Sub
  22.  
  23.       Private _ref As String = String.Empty
  24.       Public Property ref() As String
  25.           Get
  26.               Return _ref
  27.           End Get
  28.           Set(ByVal value As String)
  29.               _ref = value
  30.           End Set
  31.       End Property
  32.  
  33.       Private _type As String = String.Empty
  34.       Public Property type() As String
  35.           Get
  36.              Return _type
  37.           End Get
  38.           Set(ByVal value As String)
  39.             _type = value
  40.           End Set
  41.       End Property
  42. End Class

BLL Code
asp Code:
  1. Public Shared Function GetMaritalStatusList() As MaritalList
  2.  
  3.        Return GetMaritalStatusList()
  4.  
  5. End Function

DAL Code
asp Code:
  1. Public Shared Function GetMaritalStatusList() As MaritalList
  2. Dim MaritalList As New MaritalList
  3. Dim conn As New MySqlConnection(ConnDAL.connString)
  4. Dim mycommand As New MySqlCommand("SELECT statusref,marital_status FROM marital_status", conn)
  5. Dim rsgr As MySqlDataReader
  6.    Using conn
  7.       Using mycommand
  8.           Try
  9.              conn.Open()
  10.              rsgr = mycommand.ExecuteReader
  11.                If rsgr.HasRows Then
  12.                    Do While rsgr.Read
  13.                       MaritalList.Add(New MaritalType(rsgr("statusref"), rsgr("marital_status")))
  14.                    Loop
  15.                End If
  16.                rsgr.Close()
  17.           Catch ex As Exception
  18.                MaritalList.page_error = ex.ToString
  19.           Finally
  20.                mycommand.Dispose()
  21.                conn.Close()
  22.                conn.Dispose()
  23.           End Try
  24.        End Using
  25.   End Using
  26.  
  27.   Return MaritalList
  28.  
  29. End Function

I have run the query directly in the db and it works fine. I use exactly the same code on another ddl that I populate from the db and that works fine.

I just cannot see why this causes this error.

Any ideas?

Last edited by richyrich; November 25th, 2008 at 12:57 PM.
Reply With Quote
  #4  
Old November 25th, 2008, 12:52 PM
jmurrayhead's Avatar
The Barnfather
 
Join Date: Mar 2008
Real name: Jason
Location: Washington, D.C.
Posts: 1,962
Blog Entries: 8
Rep Power: 15
jmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud of
Default

Your posted code is hard to read..so it's hard to tell...however, I'm sure the real error is being hidden. If using IE, do you have script debugging enabled in the Internet Options? If not, you won't see the real error message. It could be a server 500 error. Make sure everything is all right with your database connection and such.
__________________
jmurrayhead
If you agree with me... click the icon!
If my post solved your problem, click the button in the lower right-hand corner of the post.

If you like it here...throw us a few bones to help
support us.

Join our Folding team: DeveloperBarn Folding

Reply With Quote
  #5  
Old November 25th, 2008, 01:00 PM
richyrich's Avatar
Administrator
 
Join Date: Mar 2008
Real name: Rich
Location: Somewhere only we know...
Posts: 1,342
Blog Entries: 6
Rep Power: 8
richyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to all
Default

Quote:
Originally Posted by jmurrayhead View Post
Your posted code is hard to read..so it's hard to tell...however, I'm sure the real error is being hidden. If using IE, do you have script debugging enabled in the Internet Options? If not, you won't see the real error message. It could be a server 500 error. Make sure everything is all right with your database connection and such.
Sorry, when I cut and post it loses all the formatting...Have reformatted it now...

I'm not sure about the script debugging...What I'd normally do when I get problems is debug by catching the errors and then writing them to the screen.

However, I've not come across this issue before where it gives a Cannot find server error, so I can't even get to try and catch any error.
Reply With Quote
  #6  
Old November 25th, 2008, 01:04 PM
richyrich's Avatar
Administrator
 
Join Date: Mar 2008
Real name: Rich
Location: Somewhere only we know...
Posts: 1,342
Blog Entries: 6
Rep Power: 8
richyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to all
Default

OK. I unticked Disable Script Debugging (Internet Explorer) and (Other) and just get a blank screen when I try and load the page.

If there is an error, I don't understand why it isn't throwing an exception...
Reply With Quote
  #7  
Old November 25th, 2008, 01:28 PM
richyrich's Avatar
Administrator
 
Join Date: Mar 2008
Real name: Rich
Location: Somewhere only we know...
Posts: 1,342
Blog Entries: 6
Rep Power: 8
richyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to all
Default

OK. Found the problem
This
asp Code:
  1. Public Shared Function GetMaritalStatusList() As MaritalList
  2. Return GetMaritalStatusList()
  3. End Function
Should have been
asp Code:
  1. Public Shared Function GetMaritalStatusList() As MaritalList
  2. Return SiteDAL.GetMaritalStatusList()
  3. End Function
I knew it must have been something easy.

Thank the lord for that....

Last edited by richyrich; November 25th, 2008 at 01:33 PM.
Reply With Quote
Reply

  DeveloperBarn Forums > Programming & Scripting > .Net Development

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

Thread Thread Starter Forum Replies Last Post
Disabling a field after the Find command kl99ny Microsoft Access 11 October 7th, 2008 06:35 PM
Server Side Includes .stm file error peebman2000 HTML & CSS Help 6 August 4th, 2008 10:29 AM
Error Type:Active Server Pages, ASP 0113 (0x80004005) guddu ASP Development 20 July 11th, 2008 09:44 AM
find words and change todd2006 JavaScript Programming 4 July 2nd, 2008 09:58 AM


All times are GMT -4. The time now is 06:21 PM.


Copyright ©2008-2010, DeveloperBarn

Content Relevant URLs by vBSEO 3.3.2