Showing posts with label view. Show all posts
Showing posts with label view. Show all posts

Friday, March 30, 2012

How to get two different SQL servers to talk to one another

Hi all I need to create a view for another sql server on the network.

I can create a view for two to databases on the same sql server to talk but how do you do it for a differend sql server??

CREATE VIEW dbo.Revocations_View
AS
SELECT TM#, LastName, FirstName, MI, SSN, [I/R #], Date, ReasonofRevocation, Notes, Termination, Conditional, WasEmployeeFined, LicenseSuspension,
Status
FROM LicensingActions.dbo.Revocations_TblUse sp_addlinkedserver (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_sp_adda_8gqa.asp) to put the servers on "speaking terms" with each other. In a secured network, you may have to deal with Security Account Delegation (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adminsql/ad_security_2gmm.asp). After you've resolved that, you need to use four part names (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/acdata/ac_8_qd_12_5vvp.asp) and you're in business.

-PatP|||thanks pat thats exaclty what I need
appreciate it :)|||a fine meal and big bottle of wine outta do it. could'nt resist.

Monday, March 26, 2012

How to get the OU information on a usr into my SQL VIew

Hi
I am reading AD Users, who are organised in different OU in my AD.
In the OU i have some organisational information that i would like to link
together
with my AD Users when i make my SQL view.
How can i join these 2 information in my SQL View ?Could you please provide schema, data and expected results.
Thanks
Peter
"sdane" wrote:

> Hi
> I am reading AD Users, who are organised in different OU in my AD.
> In the OU i have some organisational information that i would like to link
> together
> with my AD Users when i make my SQL view.
> How can i join these 2 information in my SQL View ?|||sure thing,
I have a domain int.dem.local
here i have a OU called Finance Department. On the OU there are info like
City=Roskilde and State/Proviens=2. Floor.
In the OU i have some users with the normal fields filled out like first
name, last
name, User Logon name.
In the AD these information is kept in 2 places. I would like to have a SQL
View
that shows me records like
first name, last name, User Logon name, (OU) City, (OU) State/provins
This way i can maintaine the generel information about my users location a
single
place and still have all the information in one record in my sql.
Is this possible ?
Is this want you were asking for ?
"Peter Nolan" wrote:
> Could you please provide schema, data and expected results.
> Thanks
> Peter
> "sdane" wrote:
>|||Apologies for not getting back sooner, minor problem to sort out.
I think we are talking cross purposes here. For any view to work it needs to
be in a SQL Table with data in it, I do not think it can be otherwise unless
its part of a linked server.
So could you provide some table structure i.e.what it looks like in SQL
Server tables, and possibly some play data.
Peter
"sdane" wrote:
> sure thing,
> I have a domain int.dem.local
> here i have a OU called Finance Department. On the OU there are info like
> City=Roskilde and State/Proviens=2. Floor.
> In the OU i have some users with the normal fields filled out like first
> name, last
> name, User Logon name.
> In the AD these information is kept in 2 places. I would like to have a SQ
L
> View
> that shows me records like
> first name, last name, User Logon name, (OU) City, (OU) State/provins
> This way i can maintaine the generel information about my users location a
> single
> place and still have all the information in one record in my sql.
> Is this possible ?
> Is this want you were asking for ?
> "Peter Nolan" wrote:
>|||I am using ADSI til make a linked server to connect to my active directory.
And then i have a SQLView to get the data from a user in the AD.
The AD user info is
givenname = Hans
sn = Jensen
SAMAccountname = dom.hans
This user is located in a Organisational Unit (OU) in my AD. On this OU ther
e
are info like
OU = Brugere
City = Copenhagen
State/Provinse = 2.Floor
What i want is to make a SQL View that can give me records were these two
pieces of info is joined into one record like
givenName sn SAMAccountname City
State/Provinse
----
--
Hans Jensen dom.hans Copenhagen 2.Floor
I made my Linked ser with these sql scripts:
sp_addlinkedserver 'ADSI', 'Active Directory Services 2.5', 'ADSDSOObject',
'DomServer'
sp_addlinkedsrvlogin ADSI, false, 'sa', 'AD_Reader', 'Reader'
After this a make the SQL view using this sql script:
create view v_ADSI(SAMAccountName, givenname, sn)as
SELECT * FROM OpenQuery(
ADSI_INST,'<LDAP://ou=Brugere,dc=lpb,dc=local>;(&(objectCategory=Person)(obj
ectClass=user));SAMAccountName, givenname,sn;subtree')
This gives me the ad users info, but have do i get the OU info and link it
with the
user info.
"Peter Nolan" skrev:
> Apologies for not getting back sooner, minor problem to sort out.
> I think we are talking cross purposes here. For any view to work it needs
to
> be in a SQL Table with data in it, I do not think it can be otherwise unle
ss
> its part of a linked server.
> So could you provide some table structure i.e.what it looks like in SQL
> Server tables, and possibly some play data.
> Peter
> "sdane" wrote:
>

Monday, March 12, 2012

How to get rid of the Database Login window ?

Hi, I'm a newbie in VB.Net, need some help here. I'm generating a report and view it in a win app, which is in VB.Net. I've specified the database logon info by the following code:

*************************************************
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim crtableLogoninfo As New TableLogOnInfo()
Dim crConnectionInfo As New ConnectionInfo()
Dim CrTables As Tables
Dim CrTable As Table
Dim TableCounter
Dim crReportDocument As New cr1()
With crConnectionInfo
.ServerName = "mydb"
.UserID = "myuserid"
.Password = "mypassword"
End With

CrTables = crReportDocument.Database.Tables

For Each CrTable In CrTables
crtableLogoninfo = CrTable.LogOnInfo
crtableLogoninfo.ConnectionInfo = crConnectionInfo
CrTable.ApplyLogOnInfo(crtableLogoninfo)
Next

CrystalReportViewer1.ReportSource = crReportDocument

End Sub
*****************************************************

It's an Oracle DB and just one table, suppose to be very simple. But whenever the app starts, this "Database Login" window always opens first, asking for server info, db info, user name and password. Actually if I click "Cancel", the report still get generated. So how to get rid of this annoying "Database Login" window?

My second question is, how to automatically send this report to printer? I know in VB6 you just say action=1. Unfortunately this thing doesn't work in .Net any more.

Thanks!Just look through CrystalReport knowledgebase, seems that this is a known issue. Refer to this article:
http://support.businessobjects.com/library/kbase/articles/c2010461.asp

Is there already a fix for this ?|||Figured this out by carefully reading this article: http://support.businessobjects.com/library/kbase/articles/c2010461.asp

The Form_new method has to be overwritten, adding some customized initialization, where ser/uid/pass can be specified.

**** I just took it for granted to do it in Form_load...