[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

11/22/2008 at 09:52PM PST, ID: 23928571
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.3

Can't connect to SQL Server db

OK I open VS 2005 and create a new website add a dropdownlist to the wwebpage and call it cboCountries.
Then I open the code behind and add Imports System.Data.SqlClient
Then in the Form1_Load I add:
 Dim sConnection As String = "Data Source=REDMACHINE;Initial Catalog=Northwind;User ID=csInfo;Password=csInfo;"
        Dim sSQL As String = "SELECT DISTINCT Country FROM Customers ORDER BY Country"
        Dim comm As SqlCommand = New SqlCommand(sSQL, New SqlConnection(sConnection))
        Dim dr As SqlDataReader = Nothing
        Try
            comm.Connection.Open()
            dr = comm.ExecuteReader

            While dr.Read
                cboCountries.Items.Add(dr(0))

            End While
        Catch ex As Exception
                        Return
        End Try
        dr.Close()
        comm.Connection.Close()


I run the app and everything works great a dropdownlist is on the page and has all the countries loaded in it.
Then I do the exact same thing only this time I use Windows Mobile 6 Professional Device Application.
I open VS2005 add a new project and new Windows Mobile 6 Professional Device Application.
I add a ComboBox to the device's form, I call it cboCountries.
Then I added a Reference to Systme.Data.SqlClient and then added the Imports System.Data.SqlClient to the top of the code behind page.
Then I added the same code as above:

Dim sConnection As String = "Data Source=REDMACHINE;Initial Catalog=Northwind;User ID=csInfo;Password=csInfo;"
        Dim sSQL As String = "SELECT DISTINCT Country FROM Customers ORDER BY Country"
        Dim comm As SqlCommand = New SqlCommand(sSQL, New SqlConnection(sConnection))
        Dim dr As SqlDataReader = Nothing
        Try
            comm.Connection.Open()
            dr = comm.ExecuteReader

            While dr.Read
                cboCountries.Items.Add(dr(0))

            End While
        Catch ex As Exception
           
            Return
        End Try
        dr.Close()
        comm.Connection.Close()

But when I run this I get an error say "The Specified SQL Server not found:REDMACHINE"
My computer is named REDMACHINE and both VS2005 and SQL 2000 sit on REDMACHINE.
If I change REDMACHINE to (local) I get the error "SQL Server does not exist or access is denied"
Please help I don't know what I am doing wrong.
Thanks
Matt
Sign up now to view this solution
Question Stats
Zone: Programming
Question Asked By: mutlyp
Solution Provided By: angelIII
Participating Experts: 2
Solution Grade: A
Views: 5
Loading Advertisement...
11/23/08 12:53 AM, ID: 23024181

All comments and solutions are available to Premium Service Members only. Sign-up to view the solution to this question.

Already a member? Login to view this solution.

 
12/08/08 08:04 AM, ID: 23121402

All comments and solutions are available to Premium Service Members only. Sign-up to view the solution to this question.

Already a member? Login to view this solution.

 
 
Loading Advertisement...
20080206-EE-VQP-25 - Hierarchy / EE_QW_2_20070628