显示标签为“examples”的博文。显示所有博文
显示标签为“examples”的博文。显示所有博文

2012年3月22日星期四

Anybody played with SmoBrowser example within smo?

I was looking at the smo examples that come with sql server 2005/VS 2005

and I have found quite interesting how it was neat and easy to load everthing in a treeview using reflection.

I come to my question:

I would like to load a treeview control that I could reuse in the same way but depending on the needs i would like only to load certain stuff not all of them.

EG (Not all objects but just DatabaseCollection,TableCollection)

Is there a way I can ovverride IsExpandablePropertyType so that i can decide what i can load?

any suggestions

I have adopted the SMOBrowser source code to upgrade one our products, SQL2000Print that prints SQL Server 2000 object information using DMO. The new product will do the same for SQL Server 2005 using SMO. I load the treeview only with the database objects that I want to load, and in a structure that is similar to Microsoft SQL Server Management Studio.

I have uploaded a development version to our website (here is the download link http://www.starprint2000.com/downloads/beta/sqlserverprint2005.msi) that prints Tables, Views and Stored Procedures from SQL Server 2005. You are welcome to download it and try it.

If you want to load your treeview the same/simliar way please let me know, I will be happy to share the code for loading the Treeview.

Regards,

Joginder Nahil
www.starprint2000.com

|||

Hi there

thanks for your reply.I would be extremely grateful if you could share the code for the treeview .

you can email it at vbjunkie@.hotmail.co.uk and let me know.

Thanks a lot

|||

I have modified the SMOBrowser example, that you download using the following link, to demonstrate how you can load the treeview with the datbase objects of your choice.

http://www.starprint2000.com/downloads/SmoBrowser.zip

The zip file contains readme.doc that documents the changes and provides information showing how I loaded the Treeview using XML to my own tree structure.

Regards,

Joginder Nahil
www.starprint2000.com

|||

Thanks a lot for your link.

One last question.In one scenario I just wanted to load one database,not all of them.

Can i do that?

thanks again

|||

I have modified the SMOBrowser example, that you download using the following link, to demonstrate how you can load the treeview with the database objects of your choice AND only the database in the list:.

http://www.starprint2000.com/downloads/SmoBrowserDBOnly.zip

I have modified the code for procedure PopulateCollectionItems to check if the item to be loaded is a Database object and its name is in the list of names to be loaded.

Private Sub PopulateCollectionItems(ByVal node As TreeNode)
Dim oldCursor As Cursor = Me.Cursor
Me.Cursor = Cursors.WaitCursor
Try
For Each item As Object In CType(node.Tag, ICollection)
Select Case TypeName(item)
Case "Database"
If DatabasesToLoadList.Contains(CType(item, Database).Name) Then
node.Nodes.Add(CreateNode(item))
End If
Case Else
node.Nodes.Add(CreateNode(item))
End Select
Next
Finally
Me.Cursor = oldCursor
End Try
End Sub

Regards,

Joginder Nahil
www.starprint2000.com

|||

I have modified the SMOBrowser example, that you download using the following link, to demonstrate how you can load the treeview with the database objects of your choice AND only the database in the list:.

http://www.starprint2000.com/downloads/SmoBrowserDBOnly.zip

I have modified the code for procedure PopulateCollectionItems to check if the item to be loaded is a Database object and its name is in the list of names to be loaded.

Private Sub PopulateCollectionItems(ByVal node As TreeNode)
Dim oldCursor As Cursor = Me.Cursor
Me.Cursor = Cursors.WaitCursor
Try
For Each item As Object In CType(node.Tag, ICollection)
Select Case TypeName(item)
Case "Database"
If DatabasesToLoadList.Contains(CType(item, Database).Name) Then
node.Nodes.Add(CreateNode(item))
End If
Case Else
node.Nodes.Add(CreateNode(item))
End Select
Next
Finally
Me.Cursor = oldCursor
End Try
End Sub

Regards,

Joginder Nahil
www.starprint2000.com

|||

Fantastic!!

Thanks a lot for your very good reply and quick answer!

2012年2月18日星期六

any good links on database design

I dont want to go over thru a 100 page book on the subject.
Id like a quick introductory course on database design with examples and
terminology that i could read thats possibly less than 20 pages.
Is there such a link ?
Database Design: http://www.kudzuworld.com/articles/DBDesign/
SQL:
http://www.dbbm.fiocruz.br/class/Lec...an/sqltut.html
|||On Sun, 17 Sep 2006 14:33:12 -0700, Hassan wrote:

>I dont want to go over thru a 100 page book on the subject.
>Id like a quick introductory course on database design with examples and
>terminology that i could read thats possibly less than 20 pages.
>Is there such a link ?
>
Hi Hassan,
Some googling brought me these twoo VERY short introductions on database
design:
http://www.datamodel.org/NormalizationRules.html
http://www.databasedesign-resource.c...mal-forms.html
However, p-l-e-a-s-e do not make the mistake to think that it's even
possible to become an expert in this subject by reading these pages or
any other "less than 20 pages" publication. In such a short span, only
an introduction or a quick, basic overview is possible. The reason that
most good books on DB design are welll over 100 pages is becuase that
amount of space is NEEDED to cover the subject matter.
Hugo Kornelis, SQL Server MVP
|||Database Modelling in UML
http://www.methodsandtools.com/archive/archive.php?id=9

any good links on database design

I dont want to go over thru a 100 page book on the subject.
Id like a quick introductory course on database design with examples and
terminology that i could read thats possibly less than 20 pages.
Is there such a link ?Database Design: http://www.kudzuworld.com/articles/DBDesign/
SQL:
http://www.dbbm.fiocruz.br/class/Le...man/sqltut.html|||On Sun, 17 Sep 2006 14:33:12 -0700, Hassan wrote:

>I dont want to go over thru a 100 page book on the subject.
>Id like a quick introductory course on database design with examples and
>terminology that i could read thats possibly less than 20 pages.
>Is there such a link ?
>
Hi Hassan,
Some googling brought me these twoo VERY short introductions on database
design:
http://www.datamodel.org/NormalizationRules.html
http://www.databasedesign-resource...rmal-forms.html
However, p-l-e-a-s-e do not make the mistake to think that it's even
possible to become an expert in this subject by reading these pages or
any other "less than 20 pages" publication. In such a short span, only
an introduction or a quick, basic overview is possible. The reason that
most good books on DB design are welll over 100 pages is becuase that
amount of space is NEEDED to cover the subject matter.
Hugo Kornelis, SQL Server MVP|||Database Modelling in UML
http://www.methodsandtools.com/archive/archive.php?id=9

any good links on database design

I dont want to go over thru a 100 page book on the subject.
Id like a quick introductory course on database design with examples and
terminology that i could read thats possibly less than 20 pages.
Is there such a link ?Database Design: http://www.kudzuworld.com/articles/DBDesign/
SQL:
http://www.dbbm.fiocruz.br/class/Lecture/d17/sql/jhoffman/sqltut.html|||On Sun, 17 Sep 2006 14:33:12 -0700, Hassan wrote:
>I dont want to go over thru a 100 page book on the subject.
>Id like a quick introductory course on database design with examples and
>terminology that i could read thats possibly less than 20 pages.
>Is there such a link ?
>
Hi Hassan,
Some googling brought me these twoo VERY short introductions on database
design:
http://www.datamodel.org/NormalizationRules.html
http://www.databasedesign-resource.com/normal-forms.html
However, p-l-e-a-s-e do not make the mistake to think that it's even
possible to become an expert in this subject by reading these pages or
any other "less than 20 pages" publication. In such a short span, only
an introduction or a quick, basic overview is possible. The reason that
most good books on DB design are welll over 100 pages is becuase that
amount of space is NEEDED to cover the subject matter.
--
Hugo Kornelis, SQL Server MVP|||Database Modelling in UML
http://www.methodsandtools.com/archive/archive.php?id=9

2012年2月16日星期四

Any free examples that can download and view the database?

The free one that i have downloaded doesn't seem to be able to view the database. Is there any free database which i can download? Please advise. Thanks.

For example you can download sample databases here .

2012年2月13日星期一

any *simple* external activation examples available?

BOL only seems to say that you can do it w/o really showing how, and the ExternalActivator sample at gotdotnet.com contains so much functionality I'm not sure what's required just for the external activation. Are there any docs or samples out there that focus on how to do it w/o obscuring the matter with a bunch of other functionality? (I prefer docs to project samples, b/c the samples tend to have hacks like hardcoded paths and connection strings so that they rarely work correctly right out of the box.)

TIA

The sample tries to do it correctly. That is, it must gaurantee that it will try to launch the process even under memory pressure and process failure. If it didn't, there is the danger of orphaning messages in the application queue. In order to provide this gaurantee, it must implement basic recovery logging. That adds to the complexity.

2012年2月9日星期四

ANSI NULL DEFAULT database option

Hi,

I am using SQL Server 2005 32 bit version. Could any one clarify me
the caption database option with some examples? I am quite confused
with the explanation given in MSDN. Kindly help me.

Thanks in Advance.
Om PrakashOm (bubu.prakash@.gmail.com) writes:

Quote:

Originally Posted by

I am using SQL Server 2005 32 bit version. Could any one clarify me
the caption database option with some examples? I am quite confused
with the explanation given in MSDN. Kindly help me.


I'm a little uncertain on what options you are asking about. Is it
only the ANSI NULL DEFAULT option, or is it the ANSI options in general
or options in general.

I'll expand this to the ANSI options in general, since this is a quite con-
fusing topic, and if you did not get it from MSDN one can hardly blame you.
The good news is that those settings have little importance in practice.

There are several ways to turn on the ANSI options:
o Set by default on connection with most APIs.
o Explicit SET command.
o Database option.
o The server-wide configuration option "user options".

As long as there is no explicit SET OFF command, an option is ON if any of
the four says so. And since SQL Server sets these options ON with most
APIs, if follows that these options only matters if you use API that
does not. And the only API I can think of here is DB-Library. Possibly
very old ODBC drivers.

Note that some tools, Enterprise Manager and SQLCMD, runs with some of
these off, but they send an explicit SET command, so the database
setting does not matter.

Note also that ANSI_NULLS and QUOTED_IDENTIFIER are saved with the
procedure, so here what matters is the setting at create-time, not
at run time.

The particular option ANSI NULL DEFAULT controls what this means:

CREATE TABLE gogo (a int)

Is a nullable or not? With ANSI NULL DEFAULT on, the column is nullable,
with old-style SQL Server it is not. In this particular case, my
recommendation is that you always explicitly say NULL/NOT NULL.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx