• DİKKAT

    DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
    Altın Üyelik Hakkında Bilgi

Vs2008 Vba ile SQLserver 2008 connection

mamita

Altın Üye
Katılım
10 Ocak 2021
Mesajlar
92
Excel Vers. ve Dili
2013 Türkçe
Altın Üyelik Bitiş Tarihi
24-11-2026
Arkadaşlar merhaba,

Aşağıdaki şekilde connection yapmaya çalıştığımda "Specified SQL server not found" hatası alıyorum Bu hata için yardımcı olabilir misiniz

Kod:
Imports System.Data.SqlClient

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim connectionString As String
        Dim sqlCnn As SqlConnection
        Dim sqlCmd As SqlCommand
        Dim sql As String
        ' Use this first connection string if using windows auth
        ' connectionString = "Data Source=ServerName;Initial Catalog=DatabaseName;Integrated Security=True"
        connectionString = "Data Source=KOSERVER ;Initial Catalog=TEKIL; User ID=abc; Password=abc"
        sql = "Select * from Deneme"

        sqlCnn = New SqlConnection(connectionString)
        'Try
        sqlCnn.Open()
        sqlCmd = New SqlCommand(sql, sqlCnn)
        Dim sqlReader As SqlDataReader = sqlCmd.ExecuteReader()
        While sqlReader.Read()
            MsgBox(sqlReader.Item(0))
            '& "  -  " & sqlReader.Item(1) & "  -  " & sqlReader.Item(2))
        End While
        sqlReader.Close()
        sqlCmd.Dispose()
        sqlCnn.Close()
        ' Catch ex As Exception
        'MsgBox("Can not open connection ! ")
        'End Try
    End Sub
End Class
 
Üst