منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب

نسخة كاملة : فورم التحقق من الاتصال بالسيرفر
أنت حالياً تتصفح نسخة خفيفة من المنتدى . مشاهدة نسخة كاملة مع جميع الأشكال الجمالية .
السلام عليكم لدي برنامج
يحتاج اكواد التحقق من الاتصال بسكول سواء كان يحتوي كلمة مرور او لا
thanks........
محتاج مساعدة لو سمحتم
تفضل اخي
وفي حال لم يفتح معك لاني استخدم فيجوال بيسك 2012 هذا الكود

PHP كود :
Imports System.Data.SqlClient
Public Class Form1
    Dim conn 
As New SqlConnection
    Dim cmd 
As New SqlCommand
    
Private Sub Button1_Click(sender As ObjectAs EventArgsHandles Button1.Click
        
If Connection() = True Then
            MsgBox
("Connection Successfully"MsgBoxStyle.Information"Connection")
        Else
            
MsgBox("Error")
        
End If
    
End Sub
    
Private Function Connection()
        Try
            
conn.ConnectionString "Data Source=" txtServer.Text ";Initial Catalog=" txtDatabase.Text ";User ID=" txtUser.Text ";Password=" txtPass.Text ";Integrated Security=True"
            
cmd.Connection conn
            conn
.Open()
            Return 
True
        
Catch ex As Exception

            MsgBox
("Error : " ex.MessageMsgBoxStyle.Critical"Error")
            Return 
False
        End 
Try
    
End Function
End Class 
PHP كود :
Dim conn As New SqlClient.SqlConnection()
        Try
            
conn.ConnectionString "Data Source=" txtServer.Text ";" "user id=" txtUsername.Text ";" "pwd=" txtPassword.Text ";" "Initial Catalog=" txtDatabase.Text
            conn
.Open()
        Catch 
ex As Exception
            MessageBox
.Show(ex.Message)
        
End Try

        If 
conn.State ConnectionState.Open Then
            MessageBox
.Show("تم الاتصال بنجاح")
        Else
            
MessageBox.Show("لم يتم الاتصال")
        
End If

        
conn.Close() 
بارك الله بكم وشكرا للرد