25-08-13, 10:39 PM
أو هذا ما تريد
كود :
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MsgBox(SQLServerDate(conn).ToString("MM-yy"))
End Sub
Public Function SQLServerDate(ByVal cn As SqlClient.SqlConnection) As Date
Try
cn.Open()
SQLServerDate = New SqlClient.SqlCommand("Select GetDate()", cn).ExecuteScalar
cn.Close()
Catch ex As Exception
End Try
End Function