List of Databse

Friday, December 26, 2008


How To List the Databse

Public sub DatabaseList(ByVal ListBoxObject As Object)
Try
If ObjCon.State = ConnectionState.Open Then
Dim sSQL As String = "show databases"
Dim oCmd As Odbc.OdbcCommand = ObjCon.CreateCommand
oCmd.CommandText = sSQL
Dim oRS As Odbc.OdbcDataReader = oCmd.ExecuteReader
Do While oRS.Read
ListBoxObject.Items.Add(oRS(0))
Loop
oRS.Close()
End If
Catch ex As Exception
msgbox( Err.Description)
End Try
End Function

0 comments

Post a Comment