السلام عليكم ورحمة الله ..
عملت SQL DataBase ووضعت فيها جدول واحد بإسم Name ..
وحاولت أربطها DataGridView ..
واستخدمت هذا الكود ولم يفلح
اقتباسPrivate Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.LoadDim conStr As String = "Data Source=C:\Documents and Settings\Pc3\My Documents\MySqlDb.mdf"
Dim Conn As New SqlConnection(conStr)
Dim da As New SqlDataAdapter("select * from name", Conn)
Dim ds As New DataSet
Try
Conn.Open()
da.Fill(ds, "Name")
Conn.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
DataGridView1.DataSource = ds
DataGridView1.DataMember = "Name"
End Sub
وهذا الخطأ يطلع عندي في الكود (Conn.Open):
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
فما الخلل ..