Solved

need help in connecting to sql server.

Posted on 2014-09-04
5
158 Views
Last Modified: 2014-09-09
trying to connect to a local sql server.  Services are running, name is correct, allow remote connection is on.  Tried multiple connection strings, none worked.  Attached is the error and a picture of screen.

<script language="VB" runat="server">
    Sub Page_load(Source As Object, E As EventArgs)  Handles Me.Load
        Dim strConnection As String = "server=WPC213\NetSDK;database=CUDATA; integrated security=True;"
        'Dim strConnection As String = "server=WPC213;database=CUDATA; integrated security=True;"
        'Dim strConnection As String = "server=Local;database=CUDATA; integrated security=True;"
        'Dim strConnection As String = "server=cudata; integrated security=True;"
        'Dim strConnection As String = "Data Source=local; database=cudata; integrated security=true;Initial Catalog=wages1SQL;"
        Dim objConnection As New SqlConnection(strConnection)
        Dim strSQL As String = "Select EMPLOYEENAME, SOCSEC,BANKCODE,EMPLOYMENTDATE,TERMINATEDATE from EmployeeHireInfo"
        Dim objCommand As New SqlCommand(strSQL, objConnection)
        objConnection.Open()
        test.DataSource = objCommand.ExecuteReader()
        test.DataBind()
        objConnection.Close()
       
    End Sub
</script>
0
Comment
Question by:javagair
5 Comments
 
LVL 21

Accepted Solution

by:
Randy Poole earned 250 total points
ID: 40304514
Dim strConnection As String = "Data Source=WPC213\NetSDK;Initial Catalog=CUDATA;Persist Security Info=True; integrated security=True"

Open in new window

If you are using TCP/IP instead of named pipes you may need to use:
Dim strConnection As String = "Data Source=WPC213\NetSDK,1433;Initial Catalog=CUDATA;Persist Security Info=True; integrated security=True"

Open in new window


BTW, you didn't include the an attached screen shot of the error.
0
 
LVL 32

Assisted Solution

by:Big Monty
Big Monty earned 250 total points
ID: 40305972
you can find the correct connection string at www.connectionstrings.com
0
 

Author Comment

by:javagair
ID: 40306137
the very first thing in the attached file is the error message.
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 40307090
the very first thing in the attached file is the error message.
I think the hamsters ate your attached file.  Care to post it again?  Or even better still transcribe the error message in plain text.  You would be amazed how much simpler that can be.
0
 

Author Closing Comment

by:javagair
ID: 40313316
Dim strConnection As String = "Data Source=.\cudata;integrated security=true;Initial Catalog=wages1SQL;"

looked at answers, had a talk with myself, came up with the answer by interpolation of answers.

thanks
gair
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Wufoo.com provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now