HOW TO CONNECT SQL7 SERVER TO CLIENT
I HAVE TO WORK IN VB .NET 2003 IN DATABASE SQL SERVER 7
I HAVE TO CONNET ANOTHE SYSTEM ? WHAT PROSSES CAN U HELM ME
I HAVE TO CONNET ANOTHE SYSTEM ? WHAT PROSSES CAN U HELM ME
Something like this could be a start...
Change the connectionstring and the table name in the following example.
Imports System.Data.SqlClient
Public Class Form1 Inherits System.Windows.Forms.Form
Dim myConnection As SqlConnection
Dim myCommand As SqlCommand
Dim dr As New SqlDataReader()
'declaring the objects need
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As_
System.EventArgs) Handles MyBase.Load
myConnection = New SqlConnection("server=localhost;uid=sa;pwd=;database=pubs")
'establishing connection
Try
myConnection.Open()
'opening the connection
myCommand = New SqlCommand("Select * from yourtable", myConnection)
'executing the command and assigning it to connection
dr = myCommand.ExecuteReader()
While dr.Read()
'reading from the datareader
MessageBox.Show(dr(0).ToString())
'displaying the data from the table
End While
dr.Close()
myConnection.Close()
Catch e As Exception
End Try
End Sub
End Class
Change the connectionstring and the table name in the following example.
Imports System.Data.SqlClient
Public Class Form1 Inherits System.Windows.Forms.Form
Dim myConnection As SqlConnection
Dim myCommand As SqlCommand
Dim dr As New SqlDataReader()
'declaring the objects need
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As_
System.EventArgs) Handles MyBase.Load
myConnection = New SqlConnection("server=localhost;uid=sa;pwd=;database=pubs")
'establishing connection
Try
myConnection.Open()
'opening the connection
myCommand = New SqlCommand("Select * from yourtable", myConnection)
'executing the command and assigning it to connection
dr = myCommand.ExecuteReader()
While dr.Read()
'reading from the datareader
MessageBox.Show(dr(0).ToString())
'displaying the data from the table
End While
dr.Close()
myConnection.Close()
Catch e As Exception
End Try
End Sub
End Class
Selected Articles
