Showing posts with label sqldmo. Show all posts
Showing posts with label sqldmo. Show all posts

Sunday, March 25, 2012

Creating a User Help!

I want to create a New user using SqlDmo through a VB 6.0
Any Idea?
Anybody can send me a code snippet?
Thanks
Try:
Dim oUser as New SQLDMO.User
oUser.Login = "JoeUser"
oDatabase.Users.Add (oUser)
Tom
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com
..
"Nando_uy" <Nandouy@.discussions.microsoft.com> wrote in message
news:DBA816C1-62C5-46D2-9BA6-2DF40862D6E9@.microsoft.com...
I want to create a New user using SqlDmo through a VB 6.0
Any Idea?
Anybody can send me a code snippet?
Thanks

Creating a User Help!

I want to create a New user using SqlDmo through a VB 6.0
Any Idea?
Anybody can send me a code snippet?
ThanksTry:
Dim oUser as New SQLDMO.User
oUser.Login = "JoeUser"
oDatabase.Users.Add (oUser)
--
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com
.
"Nando_uy" <Nandouy@.discussions.microsoft.com> wrote in message
news:DBA816C1-62C5-46D2-9BA6-2DF40862D6E9@.microsoft.com...
I want to create a New user using SqlDmo through a VB 6.0
Any Idea?
Anybody can send me a code snippet?
Thanks

Creating a User Help!

I want to create a New user using SqlDmo through a VB 6.0
Any Idea?
Anybody can send me a code snippet?
ThanksTry:
Dim oUser as New SQLDMO.User
oUser.Login = "JoeUser"
oDatabase.Users.Add (oUser)
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com
.
"Nando_uy" <Nandouy@.discussions.microsoft.com> wrote in message
news:DBA816C1-62C5-46D2-9BA6-2DF40862D6E9@.microsoft.com...
I want to create a New user using SqlDmo through a VB 6.0
Any Idea?
Anybody can send me a code snippet?
Thanks

Sunday, March 11, 2012

Creating a new database programmatically

I've seen several post asking for that possibility, but all 've read, didn't help me.

Some sing SQLDMO, other suggest to use SQLSMO, others only explaining to connect to a server and then do "CREATE DATABASE".

I will do this within .Net. Connecting to a SQL Server 2005 and execute "CREATE DATABASE" I could realize.
But how doing this with SQLExpress? Trying to do SqlConnection.Open with a non existing DB does not work., says "file not exists".
Or do I only have the wrong connection string? Can someone post here an excample connection string, which works with a non existing database?

Some hints I've read make me considering to use SQLSMO. But I don't have it on my computer. Where do I get it from? Any links would be nice.

You are right you can do it with DMO(data management object) and SMO(sql server management objects) but it is better to use ADO.NET ExecuteNoneQuery to create the database and objects. Try the link below for code sample. Hope this helps.

http://www.c-sharpcorner.com/Code/2002/Mar/CreatingDBProgrammaticallyMCB.asp

|||

Sorry thats was for Windows Form try the link below for code from Microsoft.

http://support.microsoft.com/default.aspx?scid=kb;en-us;305079

|||

Txh,

I've tried a similar excample and it did work for SQLServer. With SQLExpress I get an error, when opening the connection, something like "File not found".

What is the connection string for the SQLExpress? I replaces simple "Server=(local)" with "Server=.\\SQLEXPESS".

|||That code was talking about your server name, and the Master database that installs with every SQL Server. You are connecting to the Master database and file not found is not a valid error because the Master is always there. So try changing Express to your computer name. Hope this helps,|||

Sorry, if my english is so bad.

I wrote, that I've tried this excample, slightly changed and that it did work for SQL Server, but not SQLExpress.
Changing the server name to ".\SQLEXPRESS" didn't help. May be, because SQLExpress has no master database.

So, how to change this sample code that it works with SQLExpress?

|||

You cannot run SQL Server without the Master database, all your internal house keeping is done by the Master, I know I ran the Express in beta and it had a Master. And it must be your computer name and the Express for it to work YOUR_COMPUTER_NAME\SQLEXPRESS. Hope this helps.

Thursday, March 8, 2012

Creating a job for SQL 2000 using SQLDMO in c#

I have a quick question on how one can create a backup job using SQLDMO in C# I have not really been able to find any information on how to do this. I can create backups using SQLDMO and I can create Jobs but I do not know how to bind the two together. So if anyone has any information on how to do this it would be great.I can write a little sample for you if needed. But before I do, can you let me know whether doing this with SMO is an option for you? This is the object model that replaces DMO for SQL Server 2000 and allows you to work with SQL Server 2000 as well.|||sure, I would love to see the example with SMO|||

Sir,

Could you please send me the sample code that you mentioned in this post. I need to write an application than monitors the jobs running on SQL server.

Thanks alot

Ruchi

|||

Two weeks ago I posted a 3-part entry in my blog on building alert-based transaction log backups using SMO. The parts involve building a stored procedure to perform the backup, creating a job to run the stored procedure, and creating a performance-based alert to run the job.

The first entry is here: http://sqljunkies.com/WebLog/marathonsqlguy/archive/2006/08/29/23049.aspx

Hopefully that'll help.

|||

I'm writing a similar app using SQLDMO. Could you please give me sample code of how did you combine the two?

Thanks in advance.

mct.

Creating a job for SQL 2000 using SQLDMO in c#

I have a quick question on how one can create a backup job using SQLDMO in C# I have not really been able to find any information on how to do this. I can create backups using SQLDMO and I can create Jobs but I do not know how to bind the two together. So if anyone has any information on how to do this it would be great.I can write a little sample for you if needed. But before I do, can you let me know whether doing this with SMO is an option for you? This is the object model that replaces DMO for SQL Server 2000 and allows you to work with SQL Server 2000 as well.|||sure, I would love to see the example with SMO|||

Sir,

Could you please send me the sample code that you mentioned in this post. I need to write an application than monitors the jobs running on SQL server.

Thanks alot

Ruchi

|||

Two weeks ago I posted a 3-part entry in my blog on building alert-based transaction log backups using SMO. The parts involve building a stored procedure to perform the backup, creating a job to run the stored procedure, and creating a performance-based alert to run the job.

The first entry is here: http://sqljunkies.com/WebLog/marathonsqlguy/archive/2006/08/29/23049.aspx

Hopefully that'll help.

|||

I'm writing a similar app using SQLDMO. Could you please give me sample code of how did you combine the two?

Thanks in advance.

mct.

Creating a job for SQL 2000 using SQLDMO in c#

I have a quick question on how one can create a backup job using SQLDMO in C# I have not really been able to find any information on how to do this. I can create backups using SQLDMO and I can create Jobs but I do not know how to bind the two together. So if anyone has any information on how to do this it would be great.I can write a little sample for you if needed. But before I do, can you let me know whether doing this with SMO is an option for you? This is the object model that replaces DMO for SQL Server 2000 and allows you to work with SQL Server 2000 as well.|||sure, I would love to see the example with SMO|||

Sir,

Could you please send me the sample code that you mentioned in this post. I need to write an application than monitors the jobs running on SQL server.

Thanks alot

Ruchi

|||

Two weeks ago I posted a 3-part entry in my blog on building alert-based transaction log backups using SMO. The parts involve building a stored procedure to perform the backup, creating a job to run the stored procedure, and creating a performance-based alert to run the job.

The first entry is here: http://sqljunkies.com/WebLog/marathonsqlguy/archive/2006/08/29/23049.aspx

Hopefully that'll help.

|||

I'm writing a similar app using SQLDMO. Could you please give me sample code of how did you combine the two?

Thanks in advance.

mct.