473,792 Members | 2,937 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Accessing publication properties from Visual Basic (VB6)

Hi all,

I have an existing application that checks a few things before it
launches another application. One thing that the application needs to
check is the subscription properties of both the local database and the
remote (LAN) server.

I've stumbled upon some properties but I am trying to fit in the last
ones and I can't seem to find the right code to accomplish this... Can
anyone shine a little light on this please ?

The following code queries the SQL Server (remote) to get (some of) the
properties of the replicated database. What I would like to fit in
after the 'state' are the properties that you can retrieve with the
EnumAllSubscrip tions function. However, I can't seem to find the right
object (sample code) to retrieve those (or I'm just overlooking the
obvious)...

Here is (part of) the code I'm using to query the publication on the
remote server :

Dim oMergePublicati on As SQLDMO.MergePub lication2
Dim oSubscription As SQLDMO.MergeSub scription2

Me.lstPublicati ons.Clear
For Each oReplicationDat abase In
objSQLSERVER.Re plication.Repli cationDatabases
If oReplicationDat abase.Name = Me.txtSQLServer Database.Text
Then
For Each oMergePublicati on In
oReplicationDat abase.MergePubl ications
bFoundReplicate d = True
Me.lstPublicati ons.AddItem "Database replicated as
'" & oMergePublicati on.Name & "'"
For Each oSubscription In
oMergePublicati on.MergeSubscri ptions
Me.lstPublicati ons.AddItem " - subscriber
:" & oSubscription.S ubscriber
Me.lstPublicati ons.AddItem " - local
DB :" & oSubscription.S ubscriptionDB
Me.lstPublicati ons.AddItem " -
state :" & GetReplStatus(o Subscription.St atus)
Next
Next
'For Each osubscriber In oReplicationDat abase.
'Next
End If
Next
Set oReplicationDat abase = Nothing
Set oMergePublicati on = Nothing

After this, I also want to check the local DB (=pulled subscription)
and show some of the properties (from EnumAllSubscrip tions). For
example to warn the user about the need to synchronise (last_updated
value)...

Any help appreciated,

Many thanks

GB

--
Your eyes are weary from staring at the CRT. You feel sleepy. Notice
how restful it is to watch the cursor blink. Close your eyes. The
opinions stated above are yours. When I snap my fingers, you cannot
imagine why you ever felt otherwise. <snap>

Jul 23 '05 #1
2 1833
I'm not sure what you're asking - do you mean that you know that
EnumAllScubscri ptions will return the information you need, but you
don't know how to manipulate a SQL-DMO QueryResults object? If so, then
you need to iterate over it, and use the GetColumn% methods to return
the data in the format you want - in this case, GetColumnString is
probably the best one to use.

This is a simple VBScript example of using a QueryResults object:

Option Explicit

Dim oSrv, res, c, r

Set oSrv = WScript.CreateO bject("SQLDMO.S qlServer2")
oSrv.LoginSecur e = True
oSrv.Name = "MyServer"
oSrv.Connect

Set res = oSrv.ExecuteWit hResults("selec t * from sysobjects")

For r = 1 To res.Rows
For c = 1 To res.Columns
If res.ColumnName( c) = "name" Then
WScript.Echo res.GetColumnSt ring(r, c)
End If
Next
Next
If this isn't helpful, you might get a better answer in
microsoft.publi c.sqlserver.rep lication.

Simon

Jul 23 '05 #2
Sort of Simon,

I'm having difficulty to get the returnset from EnumAllSubscrip tions in
a workable object. It just returns nothing or won't compile.
In the code I've added, I managed to get the right call for the
EnumAllSubscrip tions but I'm not sure on the syntax it requires. Like :

Dim oSubscription as SQLDMO.Subscrib er2
Dim oSubscriptionDa ta as SQLDMO.<??>
For each oSubscriptionda ta in
oSubscription.E numAllSubscribe rs(SQLDMOSubscr iption_All)

OR do I need to make something like
Dim Result
Dim oSubscription as SQLDMO.Subscrib er2
Result = oSubscription.E numAllSubscribe rs(SQLDMOSubscr iption_All)
and then walk that Result for the correct data

Thanks anyway. I'll give this a try in the .repication group.

GB

Simon Hayes bracht volgend idée uit :
I'm not sure what you're asking - do you mean that you know that
EnumAllScubscri ptions will return the information you need, but you
don't know how to manipulate a SQL-DMO QueryResults object? If so, then
you need to iterate over it, and use the GetColumn% methods to return
the data in the format you want - in this case, GetColumnString is
probably the best one to use.

This is a simple VBScript example of using a QueryResults object:

Option Explicit

Dim oSrv, res, c, r

Set oSrv = WScript.CreateO bject("SQLDMO.S qlServer2")
oSrv.LoginSecur e = True
oSrv.Name = "MyServer"
oSrv.Connect

Set res = oSrv.ExecuteWit hResults("selec t * from sysobjects")

For r = 1 To res.Rows
For c = 1 To res.Columns
If res.ColumnName( c) = "name" Then
WScript.Echo res.GetColumnSt ring(r, c)
End If
Next
Next
If this isn't helpful, you might get a better answer in
microsoft.publi c.sqlserver.rep lication.

Simon


--
Your eyes are weary from staring at the CRT. You feel sleepy. Notice
how restful it is to watch the cursor blink. Close your eyes. The
opinions stated above are yours. When I snap my fingers, you cannot
imagine why you ever felt otherwise. <snap>

Jul 23 '05 #3

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

Similar topics

3
15128
by: Tom Meuzelaar | last post by:
Hello: I'm using VB6 in VS enterprise. I'd like to place an HTML form inside a VB container, have a user fill out the form information, click a submit button, and then have the program capture the field values and write them to an ASCII file on the hard drive. Can anyone confirm that this is even possible? I have dredged up one article "Accessing the Internet Explorer Document Object Model from Visual Basic 5.0" (Asmi, 1998) that covers...
2
2110
by: janice_2k | last post by:
Dear Sir/Mdm, I am writing this on behalf of my company. We bought the Visual Studio .NET Enterprise version but currently we need to use Visual Basic 6 for a small development. We are not able to purchase it anymore, anywhere we know. Therefore, I would like to know whether is VB 6 still available in the market? If not, is there any way we can 'downgrade' our license to VB 6 for a just short period of time, about 2 months. What other...
5
1445
by: Onno Ceelen | last post by:
Hi, I am testing interop code by use of some prototypes. What I have is the following: 1. VB 6.0 library 2. VB.NET class library 3. Interop assembly of the VB 6.0 library (tlbimp output) I want my VB.NET class library to have the exact same definition as my VB
11
1797
by: john andrew | last post by:
-- hello When using properties with OOP, VB6 had Get/Let and VB.net has Readonly/and .... Are theses OOP concepts with Property use or only specific to Visual Basic properties, With this property use does C++ have this as well or just Visual C++.?
1
1595
by: jimfollett1 via DotNetMonster.com | last post by:
Hey all, I was wondering if you could put me out of my misery (hopefully, not literaly) .. I am currently trying to port some VB6 code to VB.NET because of a possible significant performance improvement on a very large simulation based system. All my variables are currently encapsulated in public UDTs. If I could access these COM UDTs from a .NET dll, I will be sorted for porting the important engine of the system without having to...
2
1515
by: elnahrawi | last post by:
Download ebook http://books-download.com/?Book=1487-Visual+Basic+2005+Jumpstart Okay, all you VB6 developers--time's up. As of March 2005, Microsoft no longer supports this version of Visual Basic. And you can't blame them. Three years ago, they introduced the .NET Framework--an elegant, powerful platform--along with the new component-based VB.NET language. But roughly five million of you decided to stick with VB6, mostly to maintain...
4
3101
by: Chris Asaipillai | last post by:
Hi there My compay has a number of Visual Basic 6 applications which are front endeed onto either SQL Server or Microsoft Access databases. Now we are in process of planning to re-write these applications into Visual Basic.Net. My managers main thought is that Visual Basic 6 is (or has!) stopped being supported by Microsoft.
8
2865
by: Chris Asaipillai | last post by:
Hi there I have some questions for those experienced Visual Basic 6 programmers out there who have made the transition from VB6 to Vb.net. How long did it take you to learn at least the basic elements of VB.net....so that you were confident to write a application from scratch. This wouldnt necessarily
0
1038
by: Matt Nunnally | last post by:
Hi, I have a DLL I created in .NET. I have certain exposed properties that I have exposed that are declared as Integer or Byte arrays. Trying to access those certain properties through unmanaged code (VB6 for example) throws the following error: Function uses an automation type not supported in Visual Basic. Is there a way of getting around this from the VB6 side without have to make any changes to the DLL code?
0
10430
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
10211
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10000
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9033
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
7538
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
6776
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();...
1
4111
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3719
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2917
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.