Home Submit Snippets Cy2Online.Net  
Ads by Lake Quincy Media
 
 
 
View Snippet
VB.Net Database Get List Of Databases In SQL Server
Viewed: 35
Date: 2009-04-29
This code snippet shows how to list all the databases in an SQL Server.
View Snippet
Imports System.Data.SqlClient
 
Module Module1
 
    Sub Main()
 
        Dim server As String = ""
        Dim sqlCon As New SqlConnection("Data Source=" + server + ";Integrated Security=True")
        sqlCon.Open()
        Dim sqlCmd As New SqlCommand("sp_databases", sqlCon)
        Dim sqlReader As SqlDataReader
        sqlReader = sqlCmd.ExecuteReader()
 
        While sqlReader.Read()
            Console.WriteLine(sqlReader.GetString(0))
        End While
        Console.ReadKey()
 
    End Sub
 
End Module
New Snippets
Title Language Category Views
Edit TreeNode Example 1 C# Controls 352
Multiple Insert With One Query SQL - MySQL Insert 143
Read Image File As Bytes Visual C++ File Manipulation 159
TcpClient PortScanner Visual C++ Network 80
TcpClient Example Visual C++ Network 109
Managed And Unmanaged Example Visual C++ Miscellaneous 70
XmlDocument Example Visual C++ XML 122
Reading A CSV File Visual C++ File Manipulation 153
StreamWriter Example Visual C++ File Manipulation 150
StreamReader Example Visual C++ File Manipulation 180
Edit GridView And Save Changes ASP.Net - C# Controls 273
GridView From DataTable ASP.Net - C# Controls 218
Radial Gradient Circle Example 2 VB.Net Graphics 146
Radial Gradient Circle Example 1 VB.Net Graphics 146
Check If User Is Administrator VB.Net Security 213
Encrypt Text Using TripleDESCryptoServiceProvider VB.Net Security 140
Hash Text Using SHA1Managed VB.Net Security 117
CrystalReportViewer Example VB.Net Controls 226
Drag Drop Image File Onto Form VB.Net Controls 239
Drag Drop A File Into TextBox VB.Net Controls 224
PrintPreviewControl Example VB.Net Controls 279
Nested DataRelation VB.Net Database 92
Play System Sound VB.Net Multimedia 159
Play Wav File VB.Net Multimedia 142
Semi Transparent Panel VB.Net Controls 211
Serialize Class To XML VB.Net File Manipulation 185
Get Hidden Files In Directory VB.Net File Manipulation 135
Simple PrintDocument Example VB.Net Controls 364
Reflection Example 1 VB.Net Miscellaneous 120
Insert Image Into RichTextBox VB.Net Controls 360
Show Image With Watermark VB.Net Graphics 166
Get Memory Information VB.Net File Manipulation 156
Get Runing Processes VB.Net Miscellaneous 100
FileSystemWatcher Example 1 VB.Net File Manipulation 181
DataTable To XML VB.Net Database 179
SqlDataReader To XML VB.Net Database 205
UDP File Transfer Example VB.Net Network 335
UDP Server Example VB.Net Network 290
UDP Client Example VB.Net Network 240
Read XML File From Web Server VB.Net Network 354
Ads by Lake Quincy Media
Top Snippets
Semi Transparent Panel - C#
This snippet shows how to develop a custom panel which is semi transparent by overriding CreateParams and the OnPaint method of the Panel control.
Get File Path - C#
TThis code snippet gets the filename and path of a selected file using the FileOpenDialog Class.
Add Items To ListView Control - C#
This snippet adds items to a listview control. It loops through the files in the C:\ drive and displays the filename in the listview control.
Encrypt Text Using TripleDESCryptoServiceProvider - C#
This snippet uses the TripleDESCryptoServiceProvider Class to encrypt a string and save it to a text file. The key to decrypt the file is also saved into a seperate text file.
Read Image File As bytes - C#
This sinppet opens an image for reading as bytes. The bytes are then placed into a memorystream which is used to create a bitmap image of the bytes. The image is then set as the forms background image.
Check If File Exists - C#
This snippet checks to see if a file exists using the FileInfo Class.
Get Filename Using OpenFileDialog - C#
This code snippet gets the filename of a selected file from the Open File Dialog and displays it in a message box.
Get IP Address - C#
This code snippet will get the computers IP address.
Connect To SQLServer - C#
This simple snippet creates a connection to an SQLServer.
Simple Editable Table Columns - Javascript
This snippet allows you to edit the cells of a table.