Click here to Skip to main content
Click here to Skip to main content

MSDEGUI - a GUI tool to help developers use the MSDE database

By , 27 Nov 2002
 

Sample Image - MSDE-GUI.jpg

Introduction

If you've upgraded to Visual Studio .NET, you may not be aware that you have a database server on your hard drive. If you go to <rootdir>/FrameworkSDK/Samples/Setup/msde, there you will find a file called InstallMSDE.exe, which installs the Microsoft SQL Server Desktop Edition. This is basically SQL Server 2000, but designed to work with no more than 5 concurrent users. As far as I can see, the point of this is to allow you as a developer to write code that utilises SQL Server, and then create a product for which your customer will need to buy SQL Server, without your having to make any changes. This is somewhat similar to Oracle, who give their full product away to developers to encourage use of their product.

There's always a catch

Having a database product is all well and good, but sadly MSDE does not come with any GUI tools. If you're a beginner, it can be somewhat worrying to write code and to have only your code's return values to tell you if your database looks the way you expected. Additionally, when you're learning SQL or writing a query that is not simple, you're likely to want to be able to do it in a test environment first. Enter MSDEGUI. This program was my first using ADO.NET, and was written for exactly this reason - as I develop a product with MSDE as my database during development, it really is untenable that I am not able to check on the state of my data. Along the way I learned some ADO.NET (which was the point, after all), which I will share with you as I explain the program.

OleDb vs. Sql

Throughout I am using items with names like SqlConnection, SqlCommand, etc. If you want to use another database, all these objects have equivelents prefixed with OleDb instead of Sql, but as I wrote this to use with MSDE, I used the versions optimised for it.

Why not plug yourself in?

The first thing we need to do is connect to our database. Not surprisingly, the object to do this is called an SqlConnection, and we do it like this:

m_conn = new SqlConnection(sConnection);

try
{
    m_conn.Open();
}
catch(OleDbException e)
{
    MessageBox.Show(e.Message);
    return;
}

Our GUI accepts the a connection string and a database location, the first is used to connect via ADO.NET, the second to connect via SQLDMO. Note that unless both connections work, the program will report failure. This is also a change from the last version, we no longer build the connection string, although defaults are presented in the login dialog.

Listing databases and tables

With some help from fellow CPians, I was able to make the GUI list all databases on the current server with this query: select * from master.dbo.SysDatabases. Having populated the combo-box for databases, we populate our other combo, which lists tables in the current database, like this:

ComboBox cb = (ComboBox)sender;

m_conn.ChangeDatabase(cb.Items[cb.SelectedIndex].ToString());

SqlDataAdapter dataAdapter = 
   new SqlDataAdapter("select * from INFORMATION_SCHEMA.TABLES", 
                                                        m_conn);

DataSet ds = new DataSet();
dataAdapter.Fill(ds);

comboTable.Items.Clear();

foreach (DataRow r in ds.Tables["Table"].Rows)
    comboTable.Items.Add(r["TABLE_NAME"].ToString());

The most important point here is the need to call ChangeDatabase on our connection object. Until I worked that out, it went nowhere.

Using the main screen

So on the main screen we're able to enter a connection string, choose a database and select a table. Once we've done this, we get a grid view of the table, and we're able to browse it and make changes. Any changes you make can be reverted with the revert button, or saved to the database with the Apply button.

This magic is done by the DataGrid component. To fill a DataGrid, we pass our query to a DataAdapter, and call it's fill method. The DataSet we passed in will be filled with a view of the data requested, and we simply attach that DataSet to the grid. To get the grid to show the table right away without the need to expand anything, we need to use a syntax that tells it what table to use. It looks like this:

ComboBox cb = (ComboBox)sender;
m_sDBName = cb.Items[cb.SelectedIndex].ToString();
m_sDBFilter = "";
SqlDataAdapter dataAdapter = 
   new SqlDataAdapter("select * from " + m_sDBName, m_conn);

m_dsTables.Clear();
            
dataAdapter.Fill(m_dsTables, m_sDBName);

dgTables.DataSource = m_dsTables.Tables[m_sDBName].DefaultView;

But wait, there's more

The tool also offers an SQL window, filtering (just type your SQL 'where' clause into the bottom edit box and press 'filter'), and saving of data as XML, and also as text in the SQL window. You can press 'view' in the SQL window to alternate between a text window, and a dataGrid. The grid is nicer, and causes the save button to save as XML, but it does not show things like records affected, or the results of multiple queries.

Visual Studio .NET

After writing this article, several people have posted to present alternative tools, or point to the IDE itself as an alternative. I guess it's inevitable that others would have done what I am doing here, but the fact that so many do would seem to indicate the need for a tool on top of what the IDE offers (although the IDE is quite impressive as well). I'm not claiming to be the best, but I am hosted on the best developer site, so that will have to do.

SQLDMO

The other big request was for SQLDMO support. I had no idea what this means, so thanks to all who asked. The tool now uses SQLDMO to offer adding/removing of databases and of logins. I will shortly add manipulation of triggers and of stored procedures as well. In the meantime, the added items are as follows:

In the SQL dialog we have a button called 'Run File'. It causes a file dialog to allow browsing to an SQL file, then it attempts to execute it. I do not see a way to associate an SQLDMO connection with a database, so if your SQL assumes connection to a specific database, the results are likely not going to be what you're looking for, so beware. The code looks like this:

System.IO.StreamReader filSqlScript;
filSqlScript = System.IO.File.OpenText(dlg.FileName);
m_SQLServerDMO.ExecuteImmediate(filSqlScript.ReadToEnd(),
    SQLDMO.SQLDMO_EXEC_TYPE.SQLDMOExec_Default,    null);
filSqlScript.Close();

The main page also has a new button, labelled 'Admin'. This brings up a dialog with two combo-boxes, one labelled databases, the other users. In both cases they have a button to their right, and this will show 'Add' if a string is entered which does not correspond to an existing value in the database, and 'Remove' if the item entered does exist. The SQLDMO connection has a number of collections in it, including Databases and Logins. To remove a Database, we pass in it's name, but for some reason to remove a login we pass it's index. We therefore step through them all (they are 1 indexed, asking for item 0 results in an error), until we find the one that matches and remove it. To add an item we create an instance of the item, fill it's members with the required data, and append it to the collection. Here is the code we use for logins. Note that the password is set by calling a method designed for changing passwords. I will add the ability to change passwords shortly.

private void CreateLogin(string sLogin, string sPassword, string sDefault)
{
    SQLDMO.Login login = new SQLDMO.Login();

        login.Name = sLogin;
    login.Database = sDefault;
    login.SetPassword("", sPassword);

    m_SQLServerDMO.Logins.Add(login);
}

private void OnLoginClick(object sender, System.EventArgs e)
{
    try
    {
        switch(btnLogin.Text)
        {
            case "Delete":

                for(int n = 1; n <= m_SQLServerDMO.Logins.Count; ++n)
                    if (m_SQLServerDMO.Logins.Item(n).Name == comboLogin.Text)
                    {
                        m_SQLServerDMO.Logins.Remove(n);
                        break;
                    }
                comboLogin.Items.Remove(comboLogin.Text);
                comboLogin.Text = "";
                btnLogin.Text = "";
                break;
            case "Add":
                CreateDialog dlg = new CreateDialog(m_SQLServerDMO);

                dlg.ShowDialog();

                if (dlg.bOK)
                {
                    CreateLogin(comboLogin.Text, dlg.m_sPassword, dlg.m_sDefault);
                    comboLogin.Items.Add(comboLogin.Text);
                    btnLogin.Text = "";
                }
                break;
        }
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}

What's next?

Well, first of all I'm going to check CP, and if no-one has offered articles on the other stuff I use in the SQL window particularly, I'l expand the article to cover that. Otherwise I want to add menu options to speed up creating and dropping tables and databases, and a stored procedure window to make dealing with stored procedures easier. Any other suggestions, let me know.

Disclaimer

Thanks to Jason Henderson for the cool article helper tool, it really helped. No animals were harmed in the making of this article, except the cat, and she deserved it.

History

Version 1.2

Added SQLDMO support, including the ability to execute SQL files from disk, and adding and removing tables and logins.

Version 1.1

Fixed the problem with the hard coded string. You should still change the string to one that suits you, but if it fails it will now bring up the connection dialog.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Christian Graus
Software Developer (Senior)
Australia Australia
Programming computers ( self taught ) since about 1984 when I bought my first Apple ][. Was working on a GUI library to interface Win32 to Python, and writing graphics filters in my spare time, and then building n-tiered apps using asp, atl and asp.net in my job at Dytech. After 4 years there, I've started working from home, at first for Code Project and now for a vet telemedicine company. I owned part of a company that sells client education software in the vet market, but we sold that and now I work for the new owners.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
Questionmsdeguimemberdt292917-Aug-07 4:08 
great development app!! Can this also be used with non-MSDE databases on servers on a network for example>
QuestionHow to installmemberJKD_8119-Jul-05 3:50 
In case anyone asks again, here's what I did. On default, the connection field shows:
 
Data Source="";Trusted_Connection=true;
 
Now, assuming you've installed MSDE, right-click on the server icon in your taskbar and select "Open SQL Service Manager." Copy the contents of the Server field; for example "RIG1-76480D0FA." Paste that in between the quotation marks of the string in the connection field like so:
 
Data Source="RIG1-76480D0FA";Trusted_Connection=true;
 
Leave the other field as it is "(local)\" and click Test. You should be rewarded with a window that says "Connection Successful."
GeneralProblems Connecting to MSDEmemberstr_test28-Jun-05 18:45 
Whenever I execute the pre-compiled program that comes in the demo, I have no problems connecting to my MSDE database. Whenever I attempt to compile and use the source - either C# or VB - I get an error message stating "SQL server does not exist or access is denied." Even when I attempt to "lift" a portion of the code for connecting and use the default strings that are used in the demo, I have receive the same error message stated earlier (see sample below). I know a connection is being attempted because my firewall notifies me. I am using SharpDevelop for my IDE. Any inforamtion you can provide will be appreciated. Thanks.
 
This code below prodeces a message stating "does not exist or access is denied."
 
private void conn() {
try
{

string conn = "Data Source=\"\";Trusted_Connection=true;";
string datasource = "(local)\\";
SqlConnection sqlConn = new SqlConnection(conn);
sqlConn.Open();
sqlConn.Close();
SQLDMO.SQLServer SQLServerDMO = new SQLDMO.SQLServer();
SQLServerDMO.LoginSecure = true;
SQLServerDMO.Connect(datasource, null, null);
SQLServerDMO.DisConnect();
}
catch(Exception ex)
{
MessageBox.Show("Problem connecting: " + ex.Message);
return;
}
 
MessageBox.Show("Connection Successful");
}
GeneralRe: Problems Connecting to MSDEmemberChristian Graus28-Jun-05 18:51 
str_test wrote:
"Data Source=\"\";
 
Surely you need a machine name here, or a machine name AND a database name ?

 
Christian Graus - Microsoft MVP - C++
GeneralRe: Problems Connecting to MSDEmemberstr_test29-Jun-05 4:46 
Even when I attempt to use a string such as this:
string c = @"server=localhost;user id=sa;password=sa;trusted_connection=true;database=MatrixOrders";
for my connection string, I receive the same err message.
GeneralRe: Problems Connecting to MSDEmemberChristian Graus29-Jun-05 11:47 
weird. I know that the code as I posted it contains my connection string, which worked. Try modelling yours on that, otherwise, there must be something wrong somewhere else.

 
Christian Graus - Microsoft MVP - C++
GeneralServer ExplorermemberRyan Schreiber24-Nov-04 3:31 
Nice code demonstration, but could you not have achieved all of this using the Server Explorer -> Data Connections in the VS IDE?
GeneralRe: Server ExplorermemberChristian Graus24-Nov-04 7:57 
Apparently Smile | :)

 
Christian
 
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
GeneralThat's all well and good...memberClay McKinney24-May-05 16:44 
But some of us poor web developers can't afford the VB IDE. So thank you, Christian, for providing this alternative to the "Server Explorer."
GeneralEnterprise manager from TrialmemberToAoM20-Jan-04 0:52 
Another great option for maintaining MSDE databases is installign the SQL Server client tools which come with the SQL Server Enterprise Trial version.
 
Just download the SQL Server trial from the Microsoft website and choose the option to only install the client tools. These do not expire like the server itself does. Cool | :cool:
GeneralRe: Enterprise manager from TrialmemberBrian Delahunty28-Jun-04 22:16 
ToAoM wrote:
These do not expire like the server itself does.
 
Does the trial EULA allow you to use it after the trial period?
 
Regards,
Brian Dela Smile | :)
 
http://www.briandela.com IE 6 required.
http://www.briandela.com/pictures Now with a pictures section Big Grin | :-D
http://www.briandela.com/rss/newsrss.xml RSS Feed
GeneralRe: Enterprise manager from TrialmemberToAoM29-Jun-04 15:31 
Never checked, but EULA's aren't legal under Dutch law anyways. You need to accept and sign a EULA before delivery in Holland, or else they are void.
 
Jesse
Generalhelpmemberhjain54-Nov-03 22:39 
hi all
can u tell me what i need to insert into the 2 text field at the start.
i mean "enter the conn string:" and "enter the data source:"
it says access denied
pls help

GeneralRe: helpmemberSyska17-Dec-03 12:03 
I have the same problem, in C# when I make the conn myself i write:
SqlConnection myConnection = new SqlConnection("data source=BIGBIB\\MSDE;connection timeout=5;Integrated Security=SSPI;Database=maskinreg");
 
and it works great, but not when I post it into these 2 fields...
 
any help????
 
// ouT
GeneralRe: helpmemberChristian Graus17-Dec-03 12:05 
From memory, the code actually puts some of the more common bits in for you. Check the source to see, would be my advice.
 
Christian
 
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
GeneralRe: helpmemberAlex Evans28-Jul-04 22:03 
Did you find the answer? I too, have the same problem and will be glad to get an answer if you have one
 
Thanks
Alex
Questionhow to installmemberwebber1234567-Oct-03 16:16 
how is this installed ?Confused | :confused:
 
any examples of connection string for newbies ??
AnswerRe: how to installmemberGuillermo Rivero7-Oct-03 19:01 
data source=MINE;initial catalog=CopyColor;Persist Security Info='false';Integrated Security='true';
 
Free your mind...
QuestionWhy not use MS Access Adp file?memberOsrald1-Oct-03 20:55 
I'm just curius why you creaded this tool when access provides anything from modifying table structures to creating stored procedures.........
AnswerRe: Why not use MS Access Adp file?memberwebber1234567-Oct-03 16:18 
I have found ADP does not work with MSDE
 
I cannot get it to view or add stored procedures
GeneralRe: Why not use MS Access Adp file?memberOsrald8-Oct-03 0:49 
Try Searching "Developing Client/Server Solutions with Microsoft Access 2000 Projects" in GOOGLE........Smile | :)
GeneralRe: Why not use MS Access Adp file?memberwakewakeup6-May-05 1:25 
Have you can do it?
 

Rap
GeneralRe: Why not use MS Access Adp file?memberOsrald8-May-05 15:43 
Ok, I have tested it on MS Access 2002 version SP3. Let me assume that you have already configured MSDE on your machine.
 
Try this:
By opening MS Access, click on File->New wizard then comes out for creating a new database. Just follow the step by step instructions and you're done.
 
or
 
If you have already created a database from another tool, you can also open it on MS Access by clicking File-New and then select Project(Existing Data), from there MS Access gives you an .adp file. You can rename it if you want then click create and Data Link Properties comes out for setting-up connection properties.
GeneralViolates the license agreement.sussAnonymous22-Sep-03 10:38 
The last time I looked at the license Microsoft ships MSDE with it specifically prohibits this type of administration tool.
 

GeneralRe: Violates the license agreement.memberChristian Graus22-Sep-03 10:42 
Look again - the agreement does not allow the writing of tools that would compete with Access, but does not forbid what I have done here.
 
Christian
 
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
GeneralVisual basicsussAnonymous18-Sep-03 1:45 
I want to add head detail form, i use grid but i have problem that i want to use combo box in the detail , how to do that
GeneralSeeking for ProgrammerssussAnonymous2-Aug-03 8:55 
I'm looking for programmers who want to develop an aplication like sql buddy or pl/sql developer... of course it could have a lot of features...
Pet_Gr@hotmail.com
GeneralRe: Seeking for ProgrammerssussAnonymous2-Aug-03 8:56 
All help is welcome.. so enjoy the team.

GeneralRe: Seeking for Programmersmemberrbrennan1031-Dec-03 1:51 
Your request sounds enticing. You have heard of Toad. Right? It is a very good tool for Oracle. I can say that because it is the only tool I have used for Oracle. So I am not on to other tools.
 
rbrennan10@msn.com
 
What the?
Questionsmall problem?membergustiman24-Jul-03 1:44 
Hello!
I think your article is great!
Still, there is a small problem: if you try updating a value two times in a sequence you will receive an error message (or maybe is my SQL server configuration?): "Concurrency violation: the UpdateCommand affected 0 records." (line 368, form1.cs). It is about optimistic concurency, I guess.
Anyway, I fixed this by rebinding the data to the grid, but this is not very elegant. Anyone has a better ideea?
Thanks,
gustiman
GeneralCheck out SqlBuddy (WinForm Query Analyzer Clone)sussKris Williams17-Jun-03 18:01 
Check this out:

http://sqlbuddy.sourceforge.net/[^]

It is amazingly well done. Full Source!


GeneralRe: Check out SqlBuddy (WinForm Query Analyzer Clone)memberAlex Evans28-Jul-04 22:01 
It seems an interesting proposition - but the link goes nowhere...
 
Maybe you have the real URL for this?
 
Thanks
Alex
QuestionCrash at startup?sussXStone2-Dec-02 22:31 
Hi!
 
The demo crashes at startup: OMG | :OMG:
 
Exception: System.Runtime.InteropServices.COMException
 
Doesn't matter if I start the App after compiling the source Frown | :(
I think it crashes in the Interop.SQLDMO.dll
 
Any suggestions? Confused | :confused:
 

 


AnswerRe: Crash at startup?sussXStone2-Dec-02 22:42 
Oooh - it's early in the mornig... Smile | :)
 
Installing MSDE can make things happy Smile | :)
 
Sorry for the poisting before...WTF | :WTF:
Questionwhere?memberFayez Al-Naddaf27-Nov-02 8:52 
I could not find the InstallMSDE.exe in my computer, I have VS.NET installed and Win2k Server
Confused | :confused: Confused | :confused:
AnswerRe: where?memberChristian Graus27-Nov-02 9:57 
It's in FrameworkSDK/Bin, but only if you checked the option when installing VS.NET.

 
Christian
 
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
 
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
 
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002

GeneralRe: where?editorJames T. Johnson27-Nov-02 11:03 
I think there is a difference between the versions of VS.NET... On my copy of Pro it is in %VS.NET Install Dir%\Setup\MSDE and then run the setup.exe file.
 
Odd that it would be in different places, but I don't see it at all in FramewordSDK/Bin.
 
James
 
- out of order -
GeneralRe: where?memberSyska16-Dec-03 20:09 
its also possible to get it from MS own site, so if u can't find it, get it from the source(microsoft), then there will also be the latest SP included...
 
// ouT
QuestionWhy no SQLDMO?memberFrans Bouma26-Nov-02 4:33 
Installing MSDE will also install SQL-DMO, a great library to manage an SQLServer like MSDE. I'd suggest to include that lib into your toolkit, so you can offer more actions on the database than you can do with just T-SQL.
 
FB, author of LLBLGen
 
--
Only the true wise understand the difference between knowledge and wisdom.
AnswerRe: Why no SQLDMO?memberChristian Graus26-Nov-02 11:00 
Thanks - I will look into it. I've not heard of SQL-DMO before.

 
Christian
 
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
 
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
 
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002

AnswerRe: Why no SQLDMO?memberpaulb27-Nov-02 16:49 
I agree, this would have made the utility far more useful. Table creation and editing can be done using VS but afaik it doesn't have any admin tools. Especially useful would be ability to manage logins, attach/detach databases, backup/restore... etc.
GeneralRe: Why no SQLDMO?memberChristian Graus27-Nov-02 17:20 
Sounds great - I'd love to have a shot at this tonight. How do I do it from C#, do you know ? Do I have to write some C++ code and interop it ? Urgh.....

 
Christian
 
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
 
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
 
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002

GeneralRe: Why no SQLDMO?memberpaulb27-Nov-02 17:56 
Christian Graus wrote:
Sounds great - I'd love to have a shot at this tonight.
 
Thanks, I'll expect it to be ready by tommorrow 9:00am sharp please.
GeneralRe: Why no SQLDMO?memberChristian Graus27-Nov-02 18:11 
LOL - yes masa. Don't whip me, masa.
 
Actually, I found some docs so hopefully there *will* be an update tonight.

 
Christian
 
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
 
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
 
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002

GeneralMS Web Data AdminmemberSlavo Furman25-Nov-02 18:57 
Hi!
 
I just like add that there is also "Web Data Administrator" from MS.
 
http://msdn.microsoft.com/code/default.asp?url=/code/sample.asp?url=/msdn-files/026/002/458/msdncompositedoc.xml
(watch for word wrap)
 
It is also managed code ASP.NET app that can be used for managing/administering SQL2000 or MSDE2000.
 
SlavoF
 
"I hear and I forget. I see and I remember. I do and I understand."
--Confucius
GeneralNice work!...A few suggestionsmemberOldRob23-Nov-02 11:58 
Good Aricle, and a good start on a nice tool! A few observations/modest suggestions:
1. You catch OledbException in Connect(string sConnection). This should be SqlException, since SqlException (stupidly) does not inherit from OleDbException, but SystemException.
 
2.If you build your connection string like this:
private string BuildConnectionString(string serverName,string databaseName)
{
StringBuilder conStr = new StringBuilder(200);
conStr.Append("Server =");
conStr.Append(serverName);
conStr.Append(";Database =");
if (databaseName.Length == 0)
conStr.Append("master");
else
conStr.Append(databaseName);
conStr.Append(";Trusted_connection=Yes;");
return conStr.ToString();
}

 
you could pass it "(local)" and "master" for the initial connection parameters at application startup, and it would work for most. You could also add a combo box for the server name, and populate it from SQLDMO Dead | X| or use the NetServerEnum Api to get the list of sqlservers in the local domain/workgroup. Unfortunately you would have to create a wrapper or somesuch for this, since MS **Forgot** Roll eyes | :rolleyes: to provide any .Net Framework interfaces to this...
 
3. If you would add
if(comboDB.Items.Count > 0)
comboDB.SelectedIndex = 0;

near the end, the starting database would get filled in the combobox text, making for a cleaner initialization.
 
4. OnSelectTable fails for any tables that have imbedded spaces in the name, or are not owned by dbo. Might be better to make a small private class with proerties "Name" and "FullName" for pupulating the tables combo itemlist, The name property would be just table name, the fullName property would be r["TABLE_SCHEMA"] + ".[" + r["TABLE_NAME"] +"]". use Name as the "DisplayMember" and FullName as "ValueMember", then you can use
either the short name or the formal name wherever appropriate.
 

Again, Nice work! I am looking forward to updates..Smile | :)
 
Rob
GeneralRe: Nice work!...A few suggestionsmemberOldRob23-Nov-02 12:51 
A follow-up: there is a Nice wrapper class[^]for the NetServerEnum Api on CP already Smile | :) . This would give a good way to get a starting list of SQL servers...

 
Rob
GeneralRe: Nice work!...A few suggestionsmemberChristian Graus25-Nov-02 12:02 
Thanks for all of this, I will try to incorperate it when I get a chance.

 
Christian
 
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
 
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
 
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002

GeneralRe: Nice work!...A few suggestionsmemberChristian Graus28-Nov-02 0:57 
Thanks for the advice, I completely forgot to follow it tonight when I did some stuff with SQLDMO. I have a question though:
 
OldRob wrote:
You could also add a combo box for the server name, and populate it from SQLDMO or use the NetServerEnum Api to get the list of sqlservers in the local domain/workgroup.
 
SQLDMO does not allow me to enumerate my two MSDE instances, it just returns nothing. What is the NetServerEnum API ? Is it in MSDN ? ( SQLDMO is not mentioned in any helpful way that I can find ).
 
I hope to work on this again on the weekend, when I will remember to check out your suggestions also.
 

 
Christian
 
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
 
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
 
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002

GeneralRe: Nice work!...A few suggestionsmemberOldRob28-Nov-02 6:07 
Try this CP article[^] for server enumeration and this one[^] for users/logins etc. Frankly SQLDMO is an awful lot of overhead for stuff that can mostly be done by calling system stored procedures like sp_addUser, sp_addlogin. It is an overwieght com server with a pretty poor object model IMHO.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web03 | 2.6.130617.1 | Last Updated 28 Nov 2002
Article Copyright 2002 by Christian Graus
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid