Solved

need help in connecting to sql server.

Posted on 2014-09-04
5
170 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 33

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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
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.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…

825 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