473,785 Members | 2,428 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C# and SQLDMO

T.
I dumped VB and adopted C# for this version of Visual Studio. My problem! I
am trying to reference an SQLDMO.Database object in C# like so:

private SQLDMO.Database dbcurrent;
private string dbname;

dbname = "Northwind" ;
dbcurrent = (SQLDMO.Databas e)sqlsvr.Databa ses.Item(dbname );

But I get this error : No overload for method 'Item' takes '1' arguments.

I was hoping to avoid iterating through the SQLDMO.Database s collection to
obtain the ID of the database I want, and reference my target database via
that ID.
e.g. dbcurrent = (SQLDMO.Databas e)sqlsvr.Databa ses.ItemByID(i) ;

Any suggestions? And thanks in advance
Nov 16 '05 #1
3 5313
Are you looking for something like this

string dbName = "Northwind" ;

SQLDMO.Database db = new SQLDMO.Database ();

SQLDMO.SQLServe r srv = new SQLDMO.SQLServe r();
srv.Name = "(local)";

srv.LoginSecure = true;

srv.Connect(nul l,null,null);

db = (SQLDMO.Databas e)srv.Databases .Item(dbName,nu ll);

MessageBox.Show ("I have in my hand this database - " + db.Name + " it is
this big " + db.Size.ToStrin g());

srv.DisConnect( );


--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.konesans.com - Consultancy from the people who know
"T." <T@discussions. microsoft.com> wrote in message
news:6A******** *************** ***********@mic rosoft.com...
I dumped VB and adopted C# for this version of Visual Studio. My problem! I am trying to reference an SQLDMO.Database object in C# like so:

private SQLDMO.Database dbcurrent;
private string dbname;

dbname = "Northwind" ;
dbcurrent = (SQLDMO.Databas e)sqlsvr.Databa ses.Item(dbname );

But I get this error : No overload for method 'Item' takes '1' arguments.

I was hoping to avoid iterating through the SQLDMO.Database s collection to
obtain the ID of the database I want, and reference my target database via
that ID.
e.g. dbcurrent = (SQLDMO.Databas e)sqlsvr.Databa ses.ItemByID(i) ;

Any suggestions? And thanks in advance

Nov 16 '05 #2
T.
Many thanks Allan.

Basicall this is what I was looking for :
(SQLDMO.Databas e)srv.Databases .Item(dbName,nu ll); the null parameter to the
Item method.
"Allan Mitchell" wrote:
Are you looking for something like this

string dbName = "Northwind" ;

SQLDMO.Database db = new SQLDMO.Database ();

SQLDMO.SQLServe r srv = new SQLDMO.SQLServe r();
srv.Name = "(local)";

srv.LoginSecure = true;

srv.Connect(nul l,null,null);

db = (SQLDMO.Databas e)srv.Databases .Item(dbName,nu ll);

MessageBox.Show ("I have in my hand this database - " + db.Name + " it is
this big " + db.Size.ToStrin g());

srv.DisConnect( );


--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.konesans.com - Consultancy from the people who know
"T." <T@discussions. microsoft.com> wrote in message
news:6A******** *************** ***********@mic rosoft.com...
I dumped VB and adopted C# for this version of Visual Studio. My problem!

I
am trying to reference an SQLDMO.Database object in C# like so:

private SQLDMO.Database dbcurrent;
private string dbname;

dbname = "Northwind" ;
dbcurrent = (SQLDMO.Databas e)sqlsvr.Databa ses.Item(dbname );

But I get this error : No overload for method 'Item' takes '1' arguments.

I was hoping to avoid iterating through the SQLDMO.Database s collection to
obtain the ID of the database I want, and reference my target database via
that ID.
e.g. dbcurrent = (SQLDMO.Databas e)sqlsvr.Databa ses.ItemByID(i) ;

Any suggestions? And thanks in advance


Nov 16 '05 #3
I dumped VB and adopted C#


Good for you.
Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
6669
by: ewm | last post by:
Using InstallShield Developer 7.04. Does anyone know of a good way to detect if SQLDMO is installed? TIA mcpoo
1
6342
by: Mohammed Abdel-Razzak | last post by:
Dear sirs I`ve used SQLDMO to make a backup to my database How can I use it to restore database? thanks Mohammed
1
1748
by: C# beginner | last post by:
Hi all, I am using SQLDMO.Backup for backing up SQL server databases. I need to implement a progress bar to show the progress. I have some sample VB code that is like this: Dim WithEvents oBackupEvent As SQLDMO.Backup Set oBackupEvent = oBackup ' enable events
1
7565
by: | last post by:
Hi all My requirement is to "on button_click, backup a SQL database using SQLDMO.Backup object and update the progress in a ProgressBar. The problem is the progress bar does not update at all until the very end of the backup process, when the backup is almost going to be over, the progress bar updates itself once on a stretch, which is no use,it is not showing any progress. SQLDMO documentation says, the SQLDMO.Backup object fires
2
5521
by: | last post by:
Hi all, continued from yesterday's posting... I still haven't found a solution to this issue. I put a breakpoint in private void SqlBackupPercentComplete(string message, int Percent) { progressBar1.Value = Percent; progressBar1.Update(); }
1
2558
by: | last post by:
Hi all I am posting this to check if anyone could help me. The problem still persists. I am beginner in C#. Thanks. Subject: SQLDMO.Backup and ProgressBar - help please From: "anonymous@discussions.microsoft.com" <anonymous@discussions.microsoft.com> Sent: 11/11/2004 5:52:10 AM
0
1589
by: Craig G | last post by:
i have a small application that uses the SQLDMO com object when i build a setup package to distribute it adds both the Interop.SQLDMO.dll assembly & sqldmo.dll File the problem is that the interop.SQLDMO.dll has a dependancy on my local sqldmo.dll and appears in the dependencies box as "C:\Program Files\Microsoft SQL Server......"
6
8975
by: Craig G | last post by:
how the hell do i get this to register?!?!? my test pc is running XP & MDAC 2.8 but still it wont register SQLDMO.dll and is therefore preventing my application from running and i dont want to have to install SQL2000 Client on the test pc
3
1437
by: Brian Henry | last post by:
Anyone know why this would happen... I added a reference to the SQLDMO COM object, imported it on top of my code.. then this test code fails Imports SQLDMO Module Module1 Sub Main() Dim i As Integer
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10325
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8972
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7499
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6740
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5381
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3646
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.