Solved

need help in connecting to sql server.

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Parse field in SQL View 15 97
Using Aggregate Functions to Count 3 32
Splitting the content of a column in SQL 11 20
Sql Join Problem 2 27
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
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.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

911 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

27 Experts available now in Live!

Get 1:1 Help Now