Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7796693
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T23:26:48+00:00 2026-06-01T23:26:48+00:00

I have a search button to search the database by a name entered in

  • 0

I have a search button to search the database by a name entered in a text box, this is working fine within visual studio but when trying to use this in the hosted version i get the following message:

Server Error in ‘/’ Application.

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 – Error Locating Server/Instance Specified)

the code for this button is:

    GridView2.Visible = True

    lblEnterName.Text = ""

    If txtLoanName.Text = "" Then

        lblEnterName.Text = "Please enter a Bandie's Name"

    Else



        Dim conn As SqlConnection = Nothing
        Try
            Dim connString As String = "Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\BandDatabase.mdf;Integrated Security=True;User Instance=True"
            conn = New SqlConnection(connString)

            Dim query As String = "SELECT [SongName], [PartLearnt], [Status] FROM [Learning] WHERE ([BandieName] LIKE '%' + @Name + '%') ORDER BY [SongName]"


            Dim cmd As SqlCommand = New SqlCommand(query, conn)
            cmd.Parameters.AddWithValue("@Name", txtLoanName.Text)
            conn.Open()
            Dim dr As SqlDataReader = cmd.ExecuteReader(CommandBehavior.CloseConnection)
            Dim dt As DataTable = New DataTable()
            dt.Load(dr)
            GridView2.DataSource = dt
            GridView2.DataBind()

            lblSearchBandieName.Text = "Progress for " + txtLoanName.Text


        Finally
            conn.Close()
        End Try

    End If

I am unsure why this is bringing the error as didnt before, all i have done is changed the page the button is on.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T23:26:50+00:00Added an answer on June 1, 2026 at 11:26 pm

    did you check the information in the connection string? probably not an sqlexpres on the hosted solution. Also you may want to have the connection info in the web.config

    Now as an answer….: -)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a UI with a search text box and a button that that
I have this code that works ok when search button is pressed, but if
I have a search box and search button. I want to call a javascript
I have 6 text boxes on an asp page and one search button. Users
I have a simple search form with a box and a button. <form action
Ok, so I have this search box in which people typein a food item.
I have many buttons in a button group that need to search a database
I have a working WinForm that handles the search functionality in my customer database.
i have a textbox with button search. i would like to search my database
I have a search button tied to an update panel as a trigger like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.