DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   VB.NET (http://www.daniweb.com/forums/forum58.html)
-   -   Displaying a list of Databases in a combo box (http://www.daniweb.com/forums/thread73136.html)

mstester Mar 23rd, 2007 10:22 am
Displaying a list of Databases in a combo box
 
Hi all, (First Post...YEEERROOO)

Quick question for ya all, I have an MySQL server with three databases created on it, lets say test, test_1 and test_2. Is there a way that I can display what ever databases are stored on the server in a combo box?

I want to allow the user to be able to choose which database they want to coneect to. Any help would be cool :)

BTW Im using VB.net on VS2005

molze Mar 23rd, 2007 9:19 pm
Re: Displaying a list of Databases in a combo box
 
PrivateSub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load
Dim conn As New ADODB.Connection()
Dim rs As New ADODB.Recordset()
Dim connStr, sSQL As String
Dim Results, i As Integer
connStr = "Provider=SQLOLEDB.1;Initial Catalog=xxxx;Data Source=x.x.x.x;User ID=sa;Password=xxXXxx;Application name = New_Businessnew"
conn.Open(connStr)
sSQL = "sp_helpdb"
rs = conn.Execute(sSQL, Results)
rs.MoveNext()
Do While Not rs.EOF And Not rs.BOF
cb.Items.Add(rs.Fields("Name").Value)
rs.MoveNext()
Loop
rs.Close()
End Sub

mstester Mar 27th, 2007 9:30 pm
Re: Displaying a list of Databases in a combo box
 
Cheers, for the help man. :)

ps: sorry for the late reply :s

jayachitra_34 Mar 2nd, 2008 10:32 am
Re: Displaying a list of Databases in a combo box
 
List some difficulties which u feel could be easily soved when working with the oracle

jayachitra_34 Mar 2nd, 2008 10:34 am
Re: Displaying a list of Databases in a combo box
 
If suppose there is no database at all?what would the poeple of IT would have done?
Is there any remedy

jayachitra_34 Mar 2nd, 2008 10:35 am
Re: Displaying a list of Databases in a combo box
 
Do you think that databases are really act as the backbone for all programming languages? your comments please

Sem Shah Dec 1st, 2008 6:25 am
Re: Displaying a list of Databases in a combo box
 
Ok the solution u provide mighty be true.but can u tell me what should i write insted of **** in connection string?


All times are GMT -4. The time now is 7:32 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC