?
Solved

need help in connecting to sql server.

Posted on 2014-09-04
5
Medium Priority
?
185 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 21

Accepted Solution

by:
Randy Poole earned 750 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 750 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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Learn how to set-up custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.
Suggested Courses

770 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