15 Replies - 593 Views - Last Post: 25 September 2012 - 06:00 AM
#1
Connecting SQL Server 2005 failed
Posted 24 September 2012 - 12:43 AM
Replies To: Connecting SQL Server 2005 failed
#2
Re: Connecting SQL Server 2005 failed
Posted 24 September 2012 - 03:51 AM
Swapnilbarde007, on 24 September 2012 - 12:43 AM, said:
Please help
#3
Re: Connecting SQL Server 2005 failed
Posted 24 September 2012 - 04:13 AM
#4
Re: Connecting SQL Server 2005 failed
Posted 24 September 2012 - 04:18 AM
#5
Re: Connecting SQL Server 2005 failed
Posted 24 September 2012 - 04:21 AM
#6
Re: Connecting SQL Server 2005 failed
Posted 24 September 2012 - 04:37 AM
Imports System.Data
Imports System.Data.SqlClient
Public Class Form1
Private Sub Form1_load(sender As Object, e As EventArgs)
Dim connetionString As String
Dim connection As SqlConnection
Dim command As SqlCommand
Dim adapter As New SqlDataAdapter()
Dim ds As New DataSet()
Dim sql As String
connetionString = "Data Source=SWAPNIL;Initial Catalog=MyTestDb;User ID=sa;Password="
sql = "SELECT * FROM tblTEST"
connection = New SqlConnection(connetionString)
Try
connection.Open()
command = New SqlCommand(sql, connection)
adapter.SelectCommand = command
adapter.Fill(ds)
connection.Close()
DataGridView1.DataSource=Ds.Tables(0)
Catch ex As Exception
MessageBox.Show("Can not open connection ! ")
End Try
End Sub
End Class
End Namespace
#7
Re: Connecting SQL Server 2005 failed
Posted 24 September 2012 - 05:32 AM
#8
Re: Connecting SQL Server 2005 failed
Posted 24 September 2012 - 05:32 AM
Swapnilbarde007, on 24 September 2012 - 05:07 PM, said:
Imports System.Data
Imports System.Data.SqlClient
Public Class Form1
Private Sub Form1_load(sender As Object, e As EventArgs)
Dim connetionString As String
Dim connection As SqlConnection
Dim command As SqlCommand
Dim adapter As New SqlDataAdapter()
Dim ds As New DataSet()
Dim sql As String
connetionString = "Data Source=SWAPNIL;Initial Catalog=MyTestDb;User ID=sa;Password="
sql = "SELECT * FROM tblTEST"
connection = New SqlConnection(connetionString)
Try
connection.Open()
command = New SqlCommand(sql, connection)
adapter.SelectCommand = command
adapter.Fill(ds)
connection.Close()
DataGridView1.DataSource=Ds.Tables(0)
Catch ex As Exception
MessageBox.Show("Can not open connection ! ")
End Try
End Sub
End Class
End Namespace
I think you are missing some parameters in the Connection String.Please look at you are missing Password.If you want to get the Correct Connection String try to connect to your database in VS 2010 or 2008 using Server Explorer.After It is Connected Successfully right click on the DB in Server Explorer where you will find the Properties Click on it.You will get the Correct Connection String.
Try this and let me know :-)
#9
Re: Connecting SQL Server 2005 failed
Posted 24 September 2012 - 07:32 AM
#10
Re: Connecting SQL Server 2005 failed
Posted 24 September 2012 - 07:36 AM
Edit: is your server SWAPNIL or SWPNIL (notice the missing A)?
This post has been edited by lucky3: 24 September 2012 - 07:37 AM
#11
Re: Connecting SQL Server 2005 failed
Posted 25 September 2012 - 04:04 AM
Attached image(s)
This post has been edited by Swapnilbarde007: 25 September 2012 - 04:06 AM
#12
Re: Connecting SQL Server 2005 failed
Posted 25 September 2012 - 05:02 AM
With it not working in Server Explorer, it could be the instance name is not matching in VS. Also, have you downloaded SQL Server Management Express Studio and installed it. If so, can you access it from there?
This post has been edited by CharlieMay: 25 September 2012 - 05:05 AM
#13
Re: Connecting SQL Server 2005 failed
Posted 25 September 2012 - 05:18 AM
#14
Re: Connecting SQL Server 2005 failed
Posted 25 September 2012 - 05:29 AM
Quote
Sure can, and probably is. You need to find out on what port your IIS is running, and where XAMPP. In your browser enter localhost:80 and see what it will show. If it's xampp, than you have IIS on other port.
#15
Re: Connecting SQL Server 2005 failed
Posted 25 September 2012 - 05:44 AM
|
|

New Topic/Question
Reply



MultiQuote





|