Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Retrieve List Of SQL Instances && Databases && Tables, Etc.. VB.NET 2005


Hi,

I want to develop a tool for searching text in ALL tables & stored procedures of a given SQL Server 2005 instances / database.

I found how to find all the instances available on my machine using this code:

Code:
        Dim sqlInstances As Sql.SqlDataSourceEnumerator = Nothing
        Dim dtInstances As DataTable = Nothing

        sqlInstances = Sql.SqlDataSourceEnumerator.Instance
        dtInstances = sqlInstances.GetDataSources


But from there, could anyone help me finding all the database available for a given instance.
And in that database, how to find all tables and stored proc.


Thank you.



Edited by - dbelley_office on 6/2/2007 9:27:31 AM




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
MSSQL 2005 Server Instances
Am I just dumb or what? SQLDMO does not list the SQL2005 instances. Any ideas?

Getting SQL Server Instances, Databases And Table Names
Hi all,


1) I want to design a form which get all the instances of the sql server running on the network.

2) After selecting the server name and entering user name/pass, i should be able to select the databases.

(Same as Query Analyzer)

How To Retrieve Images SQL Server 2005 Using RdoResultset Or Streams?
How to Retrieve images SQL Server 2005 using RdoResultset or Streams? ...?

How To Retrieve Images SQL Server 2005 Using RdoResultset Or Streams?
How to Retrieve images SQL Server 2005 using RdoResultset or Streams? ...?

2 Tables In 2 Different Databases
I have two separate databases. In DB1, there is a Table1 and in DB2, Table2. I want to update Table2 with the values from Table1. Is this possible any other way than looping through different recordsets of both tables?

Getting All The Databases And Tables.
What's the best way to get all the existing databases and tables in a SQL Server?

Copy Tables Between Databases
Is there simple way to exchange table data between two databases? I use password protected Access databases.

I tried somethin like this:

Code:
Dim cnAccess As ADODB.Connection
Dim strConnString as String

strConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Database Password=password;Data Source=access1.mdb;"
Set cnAccess = CreateObject("ADODB.Connection")
cnAccess.Open strConnString

cnAccess.Execute "INSERT INTO table1 IN 'access1.mdb' SELECT * FROM table1 IN 'access2.mdb'"
This works fine with databases that are not password protected. Is there some way to directly exchange data between two opened Connection or Recordset objects?

I could use loop to perform this operation but it's much more complicated.

Tables And Databases - DBase
What is the table in a dBase file. All I have is one file, not tables within the database. Or is it like mysql where the database is actually a folder and the tables are the files inside it? I am trying to use the code from here and I cant figure out what to put for table and database. Thanks

Comparing Tables From 2 Databases!
Can anybody help me to compare tables from 2 databases! Help.......Please!

Query From 2 Tables From 2 Databases
Hello,
I need to populate a combo with a query.
The probleme is that the query must select records from a table in a database and from another table from another database.

Is it possible ?

I use Access 2000 - VB6 - ADO

Query With Tables From 2 Databases?
I have split the DB tables in two databases. One contains only information the system admin is allowed to see and the other info the users can see and create. The DB with the admin info contains, among others a table with the login names of the users. Each user is allowed to see the info he/she enters.

Now I face the following problem: There is a "super user", who is able to access all information entered by users of a particular group. For this query I have to have both databases open, select the names of all users of this particular group and then for each user select the info he/she entered!

Please, how can I do this?

For example, if we assume the following:
DB Admin
Table: Users (LoginName, GroupNum)

DB UsersData
Table Customers (custID, CreatedBy)

then the query I want to create would be like:
SELECT custID FROMCustomers WHERE CreatedBy = (SELECT LoginName FROM Users WHERE GroupNum=1)

Thanks in advance

Join Two Tables From Two Different Databases
Dear Friends,

I have two different database, having many common fields in tables in both databases. I want to join tables from both databases in a recordset is it possible if yes how?. Please reply with sample codes.

Thanks

Joining Tables From Different Databases.
Dear Friends.

Select Emp.EmployeeCode, Emp.EmployeeName,Emp.DeptCode,Dept.DepartmentName
From Emp,Dept
Where Emp.DeptCode = Dept.DeptCode.

In this query Emp table lying in the Database_1, and Dept table tying in Database_2.

How i run this query in VB by using ADODB Connectivity. I want to insert the result in another table that is in Database_3


Thanks
Bobby

! Recordset From Tables In Different Databases....
1. How to create a recordset inner joining tables which are in separate databases (hence different connections)

2. Is it possible to make separate recordsets for each and make a combined one using these?

Compare Two Tables In A Databases!
Can somebody help me out? I am new in VB! Can somebody teach me how to compare tables in 2 different database?

Retrieve From 2 Tables
I wrote a program that retrieved employee information from a sql table. The new version of software has split that table into two tables and now I must get data from both tables using a common field, employee number. I wrote the original program with an ado control. What would be the best way to access the second table... another ado control or some other way?
Bob

SQL 7.0 Frustration - Creating Databases && Tables
Hello,
I just installed SQL 7.0 at home. I have spent 2.5 hours trying to create a database and a table and I have had NO Luck. I have searched the help system, researched it on the internet and even used a super ambiguous and unclear Sam's book. With VB6 and Access I was up and running in no time at all. But SQL 7.0 seems very unintuitive.

a) Can someone please tell me how to simply create a database and a table?

b) What is the conventional way to create databases and/or tables? Through Enterprise Manager? Through the Query Analyzer?

c) Creating tables is the easiest thing in the world with Access. I sometimes use SQL "Create" statements to create tables in Access. Is that what you have to use with SQL? Or, is there a graphical method?

I will greatly appreciate any tips that will get me up and running with SQL 7.
thx
Anakin

Queries On Tables In Multiple Databases
I want to compare inventory data in an Access database to similar data in another Access database. I want to do this without importing data or making fixed links in either of the databases.

I am using Acces/VB6/ADO.

How do I link a table from one database into another using VB, so that I can run a query on it. Or alternatively how can I make a query on tables in two different databases.

(I believe to have seen something similar to the following but do not remember where. In any case it is not very ADO.)

SELECT Countries.CountryName, Regions.RegionName
FROM Regions INNER JOIN Countries in [Access: c:my databasesdb.mdb] ON Regions.RegionCode = Countries.RegionCode;

Many Thanks

Pete

Working With Multiple Tables From Different Databases
How does one design a select statement using three tables all on different databases?

One is an MS SQL server table on a database that is not the default database. The table is called "CHOOSEN" and the database is called "WORK". (Field called id is linked to a field called clientid below)

There is a MS Access table that is shared on our network drive called "ADDRESSES" and it is in the database "S:ClientsCLIENTINFO.mdb"
(Field called clientid is linked to id in CHOOSEN above, field called zipcode is linked to uszips.dbf to a field called zips below)

Finally I've got a local table called uszips.dbf in my App.path where I'm designing the VB Project. (Has a field called zips and is linked to ADDRESSES above through the field called zipcode)

Can I design an SQL statement in VB so I can get data from all three tables? I can do it in Access if I simply link all the tables into the access database but I would like to do this with code.

Appending Or Inserting Tables From Different Databases
I am trying to append tables from different databases to a single table in another database. Then, I should sort them by date. So far I programmed the followind code, but it's way too slow since it loops through all the tables. Is there another faster way to do this?

'Loop through datafiles array and add corresponding records from BrdCrmbs table to TempBrdCrmbs tables
For j = 0 To n - 1
dbLocation = DirPathDatafileDbase & datafiles(j) & ".mdb"
Set dbDatabase1 = DBEngine.Workspaces(0).OpenDatabase(dbLocation)
Set dbRecordSet2 = dbDatabase1.OpenRecordset("BrdCrmbs", dbOpenTable)
dbRecordSet2.MoveFirst
Do While Not dbRecordSet2.EOF
'consider those records where equipment attachments are been used
' If dbRecordSet2.Fields("fplow").Value = "1" Or dbRecordSet2.Fields("rwing").Value = "1" Or _
' dbRecordSet2.Fields("lwing").Value = "1" Or dbRecordSet2.Fields("scrap").Value = "1" Or _
' dbRecordSet2.Fields("sprdr").Value = "1" Or dbRecordSet2.Fields("spybr").Value = "1" Then
'consider those records that have valid patrol sections
If dbRecordSet2!PatrolSection <> 0 Or dbRecordSet2!PatrolSection <> "" Then
'consider those records that have valid measures
If dbRecordSet2!Measures <> 0 Then
dbRecordSet1.AddNew
dbRecordSet1!DatafileID = dbRecordSet2!DatafileID
dbRecordSet1!EventID = SeventID(j)
dbRecordSet1!ddate = dbRecordSet2!ddate
dbRecordSet1!tTime = dbRecordSet2!tTime
dbRecordSet1!PatrolSection = dbRecordSet2!PatrolSection
dbRecordSet1!Measures = dbRecordSet2!Measures
dbRecordSet1!FPlow = dbRecordSet2!FPlow
dbRecordSet1!Rwing = dbRecordSet2!Rwing
dbRecordSet1!Lwing = dbRecordSet2!Lwing
dbRecordSet1!Scrap = dbRecordSet2!Scrap
dbRecordSet1!Sprdr = dbRecordSet2!Sprdr
dbRecordSet1!spybr = dbRecordSet2!spybr
dbRecordSet1.Update
End If
End If
' End If
dbRecordSet2.MoveNext
Loop
Next j

Join Two Tables From Two Separate Databases
Greetings..

Does anyone know how to join two tables from two separate databases using visual basic 6? I'm using MySQL database

Linking Tables In Access Databases
Does anyone know if it is possible to link tables in Access db without showing the drive name ? (ex someone has XApps mapped to G drive and someone else to H)

Copy Tables Between Databases (MS ACCESS)
Hi all,

Is there a method of copying a table between 2 ACCESS databases with the following being true:

1. That the tables being copied are NOT part of the current database object array (as in, they are not linked and the process does not go "through" the CurrentDB)
2. No complicated CopyStructure and CopyData query processes per table.

The TransferDatabase and CopyObject methods only work on the current database array. So, I am looking for something that may look a little like this:


Code:
Public Function CopyThoseTables as Boolean
On Error Goto Err_CopyThoseTables

Dim DB1 as Database
Dim DB2 as Database
Dim rsTablesToCopy as New ADODB.Recordset
Dim tdb as TableDef
Dim blnSourceExists as Boolean
Dim blnDestinationExists as Boolean

Set DB1 = OpenDatabase("C:Database1.mdb")
Set DB2 = OpenDatabase("C:Database2.mdb")

rsTablesToCopy.Open "SELECT * FROM tblTablesToCopy", CurrentProject.connection, adOpenForwardOnly, adLockOptimistic

Do until rsTablesToCopy.EOF
blnSourceExists = False
blnDestinationExists = False
For Each tdb In DB1.TableDefs
If tdb.Name = rsTablesToCopy.Fields("fldTableName") Then
blnSourceExists = True
Exit For
End If
Next tdb

For Each tdb In DB2.TableDefs
If tdb.Name = rsTablesToCopy.Fields("fldNewTableName") Then
blnDestinationExists = True
Exit For
End If
Next tdb

If blnDestinationExists = False And blnSourceExists = True Then
CopyMyTable "C:Database1.mdb", "C:Database2.mdb", rsTablesToCopy.Fields("fldTableName"), rsTablesToCopy.Fields("fldNewTableName")
End If

rsTablesToCopy.MoveNext
Loop

DB1.Close: Set DB1 = Nothing
DB2.Close: Set DB2 = Nothing
rsTablesToCopy.Close: Set rsTablesToCopy = Nothing

CopyThoseTables = True

Exit Function

Err_CopyThoseTables:
Msgbox Error$
CopyThoseTables = False

End Function

Public Sub CopyMyTable (strSourceDatabase as String, strDestinationDatabase as String, strSourceTableName as String, strDestinationTableName as String)


End Sub

So I would need to fill the CopyMyTable sub routine with code, but i would rather not it be a query that just copies the data...


Thanks,

Dor

Compare/join Two Tables From Different Databases
Hi I am currently using a data environment to store sql queries the trouble is I have got to a query where I need to use tables from two different datasources, is this possible. The query being:

SELECT sttrgprf.register_id, sttrgprf.register_group, sttrgprf.day_of_week, MID(sttrgprf.start_time, 12, 2) & MID(sttrgprf.start_time, 15, 2) AS start_time, MID(sttrgprf.end_time, 12, 2) & MID(sttrgprf.end_time, 15, 2) AS end_time, sttrgprf.room_code, WeekNo.WeekNo FROM sttrgprf, WeekNo WHERE sttrgprf.end_week >= WeekNo.WeekNo AND sttrgprf.start_week <= WeekNo.WeekNo AND (sttrgprf.acad_period = @AcadYear) AND (sttrgprf.room_code LIKE @RoomCode & '%') AND (WeekNo.WeekNo = @WeekNo1) ORDER BY day_of_week, start_time

This essentially queries sttrgprf for all unique register id's and using there start week and end week generates an individual record for each register (because WeekNo contains no's 1 to 53). This works when I connect datasources through msaccess unfortunatley though the sttrgprf datasource is a ms sql server where no table can be added to it (designed by someone else). Any help appreciated.

Verifying Records In Two Different Tables/two Different Databases
i have table 1 in database 1 that
holds customers...

i have ALL my customers in table 2 in
database 2..

how can i check each record in table 1,
one by one, against the "Master" (table2)
to make sure they match.
i need one by one so if there is not a
match i can deal with that on an individual
basis with an if..else..

thanks in advance for all help.

Searching Multiple Databases / Tables
I have two database containing tables with peoples names in.  Database A contains 3 tables of names and database B just one table.  For simplicity I have added a Link Table to link table B into Database A - however this is a pain because it has to be refreshed constantly by the user.

I need to write a small program where the user can type a name into a text box and click a command button.  The command button then needs to search all the tables and return the record (and table name) containing the search string.

Any help would be brilliant!!

What Is The Best Way I Can Merge Two Tables From Two Different Access Databases?
The reason I'm posting this in the lounge is because it doesn't have to be done in VB. Just any method to merge the two tables, which have identically named columns and no ID(Primary/AutoNumber) columns. Although I'm open to VB solutions (vb6). Also need to append additions only (no duplicates).

Thanks in advance...

Linked Tables In Access Databases
Hi.

The problem is as follows. I have 2 Access databases. DB#1 has a table called "tb_Main". DB#2 has a link to DB#1's "tb_Main".
If I open DB#2, open the TableDef object for "tb_Main" and check the TableDef's "Connect" property, it looks like this, ";DATABASE=d:codevb estDB1.mdb".
Now, if I move the entire application and databases to a new directory, and tries to open the linked table in DB#2, it says it can't open it because DB#1 is not located in the same directory as where the link in DB#2 was created.
What I did was to create a small app that changes the "Connect" property for the TableDef object. It just simply removed the path from the the "Connect" string, only leaving ";DATABASE=DB1.mdb".
What happened next was that I opened DB#2, and checked the "Connect" string. Now it had a path, (even though I didn't specify one in the "Connect" string), pointing to the new directory. Well, that seems ok.
BUT, trying to move the app w/ DB's to another dir, I have to perform the same operation.
What I've been trying to describe here in a strange way is when a person installs a program. He specifies a location for the program, and this can vary alot.
So what can I do, do I need to specify a constant database path, like "c:MyApp-Name-DBs", or do I during the install process have to run a separate application that's changes the "Connect" property for all linked tables?

Hope someone can help me with this, and I also hope you understand what I meant.

Regards,
Michael

How To Create Tables And Databases In Oracle And How To Maintain That Using VB.6
hello there,

i want to create a database in oracle through VB.6.
not jst the database but i need to create the tables also through VB.6.

there are functions available for passing SQL commands but i have never come across a command through which we can create and maintain the oracle.
we can create and maintain if it is Access, i am searching a way for oracle .

ppl plz stretch ur hands for me

if u know about that or u have any light idea about doin that. plz lemme me know that. this is my dream to maintain such a thing.

Love u all
Sanju

How To Retrieve Data From Three Tables Within A Database?
As I know you are all programming experts, may I expect any of you to help me out with a VB problem?

I am doing a project, it is all about developing a Supermarket Transaction Control System which consists of Sales / Purchase / Inventory modules.

I created the database in ACCESS with 6 tables ( ProductRecord ; SalesRecord; CustomerRecord; SupplierRecord; PurchaseRecord and UserRecord). And I use VB6.0 to develop my system.

I use ADO as the data link to linkage the database. In each module, I apply a TOOLBAR (toolbar.buttoms.item(array)) to perform ADD / DELETE and SEARCH functions.

Currently, my Customer Record works. It can perform add new record, delete record and search record. (It retrieves data from CustomerRecord table only). In the same way, I created Sales Record which should retrieve data from 3 different tables within the database ( SalesRecord table; ProductRecord table and CustomerRecord), however, my Sales Record can’t perform ADD function properly.

The problem is:-
When I add a new record with proper Sales Record ID; Product ID and Customer ID, it produce me three different records with same Sales Record ID. Let say, I have 3 customers record, 3 product records, when I add a new sales record with one of three customer and one of three products, it produces three records with different customers and different products.

I think my coding part for retrieving data from different tables and write to one table. But I don’t know how to fix it. Can any of you help me?

Attached is my SalesRecord coding

Can We Retrieve Data To Datagrid From 2 Tables
I need to retrieve data from 2 table at the same time and to display it to a grid.Only the id field is same in both the tables.Rest of the fields r different.

Now I'm using datagrid and I'm not getting data from 2 tables at one stretch.


Please help me with suggessions

grm

Retrieve Structures Of Tables Through VB Coding?
Hi
My question is this!

Is there any way to retrieve the structures of all the tables in the database
and write them to a file (Text file or somthing else...) through VB coding,
for trouble-shooting and maintenance purposes?

Advance thanks
Ansoft
(I am new to programming)

Retrieve Data From Three Diff Tables
if some one of u can resolve my problem. I have three tables for example
No.1= Jobs (Job Master File)
No.2= Trans (Issue Transaction File)
No.3 = Bills (Billing Transaction File)

My query is that to calculate Total Issued Quantity which is in Trans table and Total Billed Quantity which located in Bills table. When i select in record set, the un expected result comes out. Following is coding for that.

With ViewRs

.ActiveConnection = MyDb
.CursorLocation = adUseServer
.LockType = adLockOptimistic
.CursorType = adOpenStatic
.Properties("irowsetidentity") = True
.Open "select e.jobno,sum(t.issueqty) as Issued,sum(b.billedqty) as
Billed " & _
"FROM (enquiry e INNER JOIN trans t ON " & _
"e.jobid = t.jobid) LEFT OUTER JOIN bills b ON " & _
"B.jobid = E.jobid " & _
"WHERE t.manualchallanno > 0 GROUP BY e.jobno"
End With



Expand AllCollapse All

How To Retrieve Data From Multiple Tables?
Hello all!

I need to retrieve the name of the jobs existing in sql server agent and at the same time, their respective schedule.

Using the statement "SELECT name AS JobName FROM sysjobs" will retrieve the names of the jobs and using the statement "SELECT freq_type AS JobSchedule FROM sysjobschedules" will retrieve the schedule type of the respective jobs.

But I need to display the job name and the job schedule type together, executing the appropriate sql statement in SQL Query Analyzer. How do I go about using the SELECT statement for 2 different tables?

The "appropriate" SQL, when executed, should produce:
--------------------------------
JobName /JobSchedule/
--------------------------------
Job1 /4 /
Job2 / 64 /


Thanks in advance




Edited by - MMC_Newbie on 10/16/2002 11:07:04 PM

List Of Sql Server Instances
Is there a way I can search the local netowkr and get a list of the available sql server instances??

[2005] Adding Stuff To List Box
A rather silly problem but I'm taking a VB course at my school, but they have an older version in which you add text (or whatever) from a text box to a list box when you, let's say, press a command button with (I think)
listname.additem boxname.txt
But in the VB 2005 express edition that I downloaded it's not the same.
Forgive my trivial question but it some help would be nice.

Search All Instances Of Each Item In A List
Here's my situation: I have a long list of data. I want to search column "d" for a variable (entered somewhere) and each time that variable appears, I want the whole line to be copied to a new list. I can do the find command but I can't get it to loop through the whole list. Please help.

List Box And Databases
I want users to be able to select options from a list of categories. These categories are held in a database. Is it possible to use a list box to display all your database fields or is there a better method.

List Of All VB Databases
Hi,

I am looking for a list of databases, that supported by Visual Basic 6.0 and comparision between them. Anyone has any idea, from where I can get (website etc..)?

Thanks



List All The Databases
Can someone give me the code generate a list of the names of all the databases from the server that i choose...???

I already list all of the sql server.. but now i need to know if i can list the databases...

Thanks a lot!

Get A List Of Databases
Hi! I have a short question...

On the attached picture I can see a DataLink dialog
that allows me to choose a database source from
a specified SQL server.

I've written a program that also connects successfully
to a SQL server but I don't know how to get a list of
available databases.

When my application starts, the 'Initial Catalog' parameter
is set to null and so it connects to the first database
entry (in this case 'master').

Any ideas how to get a list of databases from the specified
SQL server?

thx!

Define Excel Tables In Vb 2005 Using Excel.xls File
Hi, i am making an application that will use a access database and an excel spread sheet. It will basically save data from mutiple text box inputted by the user into both excel and access. The part of the application i need help with is below what i am trying to do is learn how to define the table in the excel tables. I have looked around and have had no progress with defining tables field. Below i have included in the comments the definition type for each column. If possible I would like to have a complete list of excel definition for the field I can use with excel oledb. Any help will be surely appreciated. thx.







example:

dim fName as string = textbox1.text

dim lName as string = textbox2.text

dim ClientID as string = textbox3.text



'==========================================================================

' Create a excel workbook with a table named Interviews. The table has 10

' fields: ClientID (autoNumber), lastName (char 20), firstName(20),

' phone(number), email(20), date(date), time(time), Voicemail(true/false),

' callBack(true/false), Scheduled(true/false).

'==========================================================================

Dim conn As New OleDbConnection()

conn.ConnectionString = m_sConn1

conn.Open()

Dim cmd1 As New OleDbCommand()

cmd1.Connection = conn

cmd1.CommandText = "CREATE TABLE Interviews (ClientId autoNumber, lastName varchar(20), firstName varchar(20))" ' and so on.........................................

cmd1.ExecuteNonQuery()

cmd1.CommandText = "INSERT INTO Interviews (ClientId, lastName, firstName) values (" & ClientID & lName & fName & ")" ' and so on............................................

cmd1.ExecuteNonQuery()

conn.Close()

List Boxes And Databases
The Following is the sode to part of my program which has a search option from a text box which finds and displays relevant inofrmation. A combo box displays different types of holiday which the display button displays the relevent holiday names in a list box, what i need todois when i click on one of the hotel holiday names in the list box tohave the relevant information displayed in text boxes like the search screen did. Can anyone help???? I think its something to do with the seek command but im not sure.


Code:
Private Sub btnDisplay_Click()
lstResort.Clear

If cmbHolidayCat.List(cmbHolidayCat.ListIndex) = "Sun" Then
'ChDir App.Path
Data1.DatabaseName = "C:DatahciPollydatabaseebtc.mdb"
Data1.RecordsetType = 2 'snapshot
Data1.RecordSource = "Select [ResortName], [ResortDescription] FROM [Resort] WHERE [ResortDescription] = 'Sun' Order by [ResortName]"
Data1.Refresh
Dim s1 As String


Do While Not Data1.Recordset.EOF
lstResort.AddItem Data1.Recordset("ResortName") & " "
Data1.Recordset.MoveNext
Loop

Else
If cmbHolidayCat.List(cmbHolidayCat.ListIndex) = "Skiing" Then
'ChDir App.Path
Data1.DatabaseName = "C:DatahciPollydatabaseebtc.mdb"
Data1.RecordsetType = 2 'snapshot
Data1.RecordSource = "Select [ResortName], [ResortDescription] FROM [Resort] WHERE [ResortDescription] = 'Skiing' Order by [ResortName]"
Data1.Refresh


Do While Not Data1.Recordset.EOF
lstResort.AddItem Data1.Recordset("ResortName") & " "
Data1.Recordset.MoveNext
Loop

Else
If cmbHolidayCat.List(cmbHolidayCat.ListIndex) = "Sporting" Then
'ChDir App.Path
Data1.DatabaseName = "C:DatahciPollydatabaseebtc.mdb"
Data1.RecordsetType = 2 'snapshot
Data1.RecordSource = "Select [ResortName], [ResortDescription] FROM [Resort] WHERE [ResortDescription] = 'Sport' Order by [ResortName]"
Data1.Refresh


Do While Not Data1.Recordset.EOF
lstResort.AddItem Data1.Recordset("ResortName") & " "
Data1.Recordset.MoveNext
Loop

Else
If cmbHolidayCat.List(cmbHolidayCat.ListIndex) = "Cruise" Then
'ChDir App.Path
Data1.DatabaseName = "C:DatahciPollydatabaseebtc.mdb"
Data1.RecordsetType = 2 'snapshot
Data1.RecordSource = "Select [ResortName], [ResortDescription] FROM [Resort] WHERE [ResortDescription] = 'Cruise' Order by [ResortName]"
Data1.Refresh


Do While Not Data1.Recordset.EOF
lstResort.AddItem Data1.Recordset("ResortName") & " "
Data1.Recordset.MoveNext
Loop

Else
If cmbHolidayCat.List(cmbHolidayCat.ListIndex) = "" Then
MsgBox "Please choose a valid holiday type"
End If
End If
End If
End If
End If




End Sub

Private Sub btnExit_Click()
End
End Sub


Private Sub btnSearch_Click()
Dim Search As String
Dim sBookMark As String
searchvar = Text1
searchvar = Trim$(searchvar)
If searchvar <> "" Then
With Data1.Recordset
sBookMark = .Bookmark
.FindFirst "ResortName like '" + searchvar + "*'"
If .NoMatch Then
MsgBox "No Matching Record"
.Bookmark = sBookMark
End If
End With
End If
End Sub

Private Sub Form_Load()
cmbHolidayCat.AddItem ("Sun")
cmbHolidayCat.AddItem ("Skiing")
cmbHolidayCat.AddItem ("Sporting")
cmbHolidayCat.AddItem ("Cruise")

End Sub
Edit: Added [code[/code] tags

List Servers And Databases
I'm working in Visual Basic 6 and trying to populate a combo box with all the server names available locally. Once a server is selected from a combo box I want to populate another combo box with all the databases available on that server.

If anyone could help it would be much appreciated.

Cheers
Rob

List Boxes && Databases
Okay, this is a really hard question. (for me anyways)

You guys will probably laugh at it lol.


Code:
kmdbHouse.Recordset.MoveFirst
Do While Not kmdbHouse.Recordset.EOF
hList.AddItem kmdbHouse.Recordset("Name")
kmdbHouse.Recordset.MoveNext
Loop
I'm using this to populate a list box called hList. Now, when ever i click on the list box it changes the database field Name. I don't want it to change the database field "Name" to what ever is selected. What i would like it to do, would be :-

Algorithm

Click hList

Get the "Name" that the user clicked on from the List box

Assign it to a variable

DO NOT CHANGE THE DATABASE IN ANY WAY.

.............phase2

Once i have this value (in this case its harry potter house names) such as Gryfindor. I would like to search a second table for all of the people who are in gryfindor and populate a *second* list box with the names of the people in gryfindor (in kmdbhouse Name is the name of the house) The second table is kmdbChar and fullname is the table heading. The two tables are linked by a key which is an autonumber E.G

Gryfindor has a key of 3

HarryPortter is in house ref 3 therefore he is in gryfindor

If you don't understand Phase 2, ill try and solve it once i have the hlist selected value.

SQL: (no Items) In Databases List
Hello,

I just hosted my site with an SQL Database on the remote web server.
I can connect to the SQL Server as 'sa' and can perform any operation as an administrator, but if I connect to the SQL Server as the secondary user, I can not view the assigned database to this user.
I can connect to the datbase from my ASP/VB applications without any problem, but whenever I need to have some administration over my database and I need to connect to the remote SQL Server with the secondary user name and password... There is just "(no items)" under databases tree.
I can see the list of SQL users under Security tree, but just can't view my own database... What could be the problem? any suggestions?

Regards.

Displaying List Of Available Databases
I am creating a userform to compare tables in different databases. How do i go about populating a listbox with all the database names associated with my SQL Server 2000 instance? I would rather populate a list than creating text boxes to select of the databases i know will exist, users will also create new databases so that approach would be flawed.

So anyone know how i can do this using VB? I just want to know how to access the database names since usually you need the database name to connect to SQL Server to begin with

-Evan

List Databases On A Server
Hey Guys,

Quick question. I'm writing a log on screen for my app at the moment which logs onto SQL servers and databases. I've already written the code where it adds all names of each servers to a combo box using SQLDMO. The thing I need now is to write some code that updates a combobox for the databases available for the server selected above.

Any ideas?

BukBuk

List Boxes And Databases
Wooo first post!!

I am using DB5 because the access version at college wont work with the VB at college!
When I use the data control I can link it to a text box and cycle through but if I link it to a list box nothing shows up what am I doing wrong? I am not coding any of it now, do I need to

Copyright © 2005-08 www.BigResource.com, All rights reserved