Link to home
Start Free TrialLog in
Avatar of Chakri25
Chakri25

asked on

What is SQL-DMO? How do i access SQL server through VB?

Hi all,

I have a classic problem, i want to access users, roles and create permissions in SQL server using VB, but not get into SQL server Enterprise Manager everytime.

I have come across SQL-DMO and SQL-NS, i was wondering do i need to create the VB app from scratch or use one of the above ulitily which is readily available. If so where can i find the uliltity, cos i could not find it on SQL server Standard Edition CD. Are there any third party software available. Please also check the following links.

http://www.microsoft.com/technet/treeview/default.asp?url=/technet/prodtechnol/sql/reskit/sql2000/part10/c3561.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sqldmo/dmoref_con01_2yi7.asp
Avatar of ShogunWade
ShogunWade

SQL DMO is not a "utility", it is a collection of objects in a DLL,  It is used as the basis for for implementation of sql EM.

To use it in VB you simply need to add a reference to the DLL and call the relevent methods properties and functions of it to achive what you want.
Avatar of Chakri25

ASKER

Thanks so much for replying ShogunWade,

Could you please guide me, i mean start me off possibly as to how to create a user and assign persmissions in a sample database in sql server, using VB (via sql dmo).

I mean i have looked at the following installing procedures and executed a sample code

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sqldmo/dmoref_con01_8eun.asp

but it gives me an error.

Thanks for your help in advance
scsandur@yahoo.com
Avatar of Anthony Perkins
For the record:
Questions Asked: 5
Questions Open: 3
Questions Graded: 0
Questions Deleted: 2

Anthony
what version of VB do you use   6 /  .NET ?   My VB is a touch rusty.
ShogunWade,

I'm using VB 6 and i'm goin to run the VB application on the server.

Thanks, awaiting your reply
ASKER CERTIFIED SOLUTION
Avatar of ShogunWade
ShogunWade

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Chakri25, make sure you go to the references of you VB project and add the reference to "Microsoft SQLDMO Object Library".

After you do that, you can use object browser to view all the properties and methods that you have available to you.

Brett
Thanks albert and ShogunWade for all your input

I have tried browing through the folder

C:\Program Files\Microsoft SQL Server\80\Tools\Devtools\Samples\Sqldmo\Vb\

and was able to find various form's login, create database, create table etc

the problem is how do i integrate into one application and apart from that i need a lot more funcationlaity than that. For eg: i should be able to give specific persmissions to a user of the database, like say only select.

I had a link for sql-dmo third aprty tool, but am unable to find it now i beleive it was in a europe site , but the following link
also has substitue for this. Can you all check it out and gimme your inputs

http://www.sharewaresoft.com/SQLExecMS-downloads-21772.htm
(SQLExecMS 2.0- a substitue for SQL-DMO)

Thanks
You can accomplish this all with ADO by calling into existing stored procedures.

Check out:

sp_addlogin  
sp_addsrvrolemember
sp_grantdbaccess
sp_addrolemember

Or

http://support.microsoft.com/default.aspx?scid=kb;en-us;183621
I would tend to agree with kathmacmahon.  Although SQLDMO is useful, if there are existing procs that exist to accomplish a function--I would use them.
I concur with kath and arb,  I personally would not use SQLDMO for most of what you seem to want to do.

But im confused,  you say that the application will run on the SQL server host, you appear to want all the functionality of SQL Server Enerprise Mgr.... Why not just use EM ?
That's true ShogunWade,

it seems waste since i can use SQL EM if i have only 1 server, i'm still thinking about this implementation.
So now that you have decided that there is no point in reinventing the wheel and Enterprise Manager will do what you need, let me explain to you how it works here at EE:  You consider who offered the best solution and you award the points, accordingly.  What you do not do:  Arbitrarily delete the question or abandon it completely.  If you have any further questions on this follow this link http://www-tcsn.experts-exchange.com/help/qnaFAQ.jsp

Finally, if you consider my comments inappropriate feel free to contact Community Support.

Thanks,
Anthony