Showing posts with label form. Show all posts
Showing posts with label form. Show all posts

Sunday, March 11, 2012

Active directory + list users

I neet save user login form active direcotry to databases. How I can make that?

If you're using Trusted Security to connect to the database (In other words, every single user is authenticated to the database with their windows logon), you could write code like the following at the database level:

INSERT Users
(Username)
(SUSER_SNAME())

SUSER_SNAME, gives you the current authenticated user to the database.

If you're connecting to the database using a Sql Server Login, but are using windows authentication in your .net application you could write the following code:

Dim _sql as string
_sql = "INSERT Users (USERNAME) VALUES ('" + My.User.Name "')"

And just execute this code against the database.

Hope this helps,


active directory

hey

i'm trying to pass to a report the info of the person who vieuws the report as stored in the active directory.

i have read many posts on the form and did a google on the subject and i found that there is a global parameter userid. this is not wat i need.

i also have read that you can use an oledb connection but i can't get it to work. i think the "Microsoft OLE DB Provider for Microsoft Active Directory Service" is not installed. (when i press edit next to connection string field, the option isn't available in the ole db provider list)

any help or thoughts would be apreciated.
thanks jens.

Addition: error i get

A connection cannot be made to the database.
Set and test the connection string.

Format of the initialization string does not conform to specification starting at index 23. (System.Data)

Tuesday, March 6, 2012

Acess and VB

Hi all,
If I have a form created on MS Access, could I copy it exactly the same form to VB form, so that users could exactly perform operations the same on Access form?
thanks again for caring
Any suggestion and comments would be Acceptable

Suggestion: Go to an MS Access forum.

AceCollection

I have made some decent progress on switching RS to use form based
authentication. Currently the application validates the user against
are Oracle database, then accepts the cookie created by the page and
then converts the cookie into a principal object which is used for the
authorization portion of the process. I have this working as long as
the user is an Admin, but I have a problem if they are not. When the
subroutine goes into the authorization portion of code for a non-admin
user, it calls an ACL. By looking at the code as it runs it would seem
that the ACL is empty, how can I modify this to add policies for users
or groups? Is the ACL an actual object that I can open an edit, sorry
I am new to most of all of this.
ThanksYou need to modify the CheckAccess functions in Authrorization to loop
through the username and all the groupnames the user is part of. That way,
it will apply role-based security. Something like this:
ArrayList userGroups = GetUserGroups(userName);
AceCollection acl = DeserializeAcl(secDesc);
foreach(AceStruct ace in acl)
{
foreach(string principalName in userGroups)
{
// First check to see if the user or group has an access control
// entry for the item
if (0 == String.Compare(principalName, ace.PrincipalName, true,
CultureInfo.CurrentCulture))
{
etc.
etc.
--
Cheers,
'(' Jeff A. Stucker
\
Business Intelligence
www.criadvantage.com
---
"Will" <wlansing@.rlcarriers.com> wrote in message
news:1110232152.683072.256120@.g14g2000cwa.googlegroups.com...
>I have made some decent progress on switching RS to use form based
> authentication. Currently the application validates the user against
> are Oracle database, then accepts the cookie created by the page and
> then converts the cookie into a principal object which is used for the
> authorization portion of the process. I have this working as long as
> the user is an Admin, but I have a problem if they are not. When the
> subroutine goes into the authorization portion of code for a non-admin
> user, it calls an ACL. By looking at the code as it runs it would seem
> that the ACL is empty, how can I modify this to add policies for users
> or groups? Is the ACL an actual object that I can open an edit, sorry
> I am new to most of all of this.
> Thanks
>|||Jeff, thanks for the response. I think that I still maybe a step
behind you though, can you tell me where the information for this call
comes from. AceCollection acl = DeserializeAcl(secDesc);
When I debug though this code, the acl is always empty and therefore
never gets into the foreach loop. Am I doing something wrong? Thanks
again for your response.

Thursday, February 16, 2012

Accessing SQL Server temp table for Access Project

Hi,
I am trying to use a temp table as the record source for a listbox on a access project form.
I have no problem creating the temp table and inserting data to it, but I can't access it from MS Access (every thing works on Query Analyzer).
I know that local temp tables are deleted when the connection is lost, but I'm on the same form that create the temp table, why can't I access the data??
(It works when I use global temp tables like ##Test, but I can't use global temp tabels for my application)

Here is my code, any idea what the problem might be?

Dim Rs As ADODB.Recordset
Set Rs = New ADODB.Recordset

Dim SQL As String

SQL = "exec sp_dropMListSource "
SQL = SQL & "SELECT distinct dbo.tblContact.ContactID,ISNULL(dbo.tblContact.Fir stName, '') "
SQL = SQL & "+ ' ' + ISNULL(dbo.tblContact.LastName, '') AS [Contact Name]"
SQL = SQL & "INTO #MListSource "
SQL = SQL & " FROM dbo.tblContact INNER JOIN dbo.tblProperty ON "
SQL = SQL & "dbo.tblContact.ContactID = dbo.tblProperty.ContactID "
SQL = SQL & "WHERE dbo.tblProperty.Zip in (" & Me!zips & ")Order By [Contact Name]"

Rs.Open SQL, CurrentProject.Connection, adOpenDynamic, adLockOptimistic

Me.MListSource.RowSource = "Select ContactID, [Contact Name] From #MListSource"

Set Rs = Nothing>> I know that local temp tables are deleted when the connection is lost
Nope - it is dropped when the batch completes.
In your case the batch is the create statement.|||nigelrivett Not exactly try the following, works just fine.

create table #Tmp(f1 int)
go
insert into #Tmp values(1)
go
select * from #Tmp
go

Sia Okay, this is just a guess but what happens if you run profiler as you step through your code? I am thinking that the temp table is alive until you execute the "Set Rs = Nothing". I think this implicitly (sp?) closes the connection and as a result your temp table goes away.

Here is a blerb from BOL:

Temporary tables are automatically dropped when they go out of scope, unless explicitly dropped using DROP TABLE:

A local temporary table created in a stored procedure is dropped automatically when the stored procedure completes. The table can be referenced by any nested stored procedures executed by the stored procedure that created the table. The table cannot be referenced by the process which called the stored procedure that created the table.

All other local temporary tables are dropped automatically at the end of the current session.

Global temporary tables are automatically dropped when the session that created the table ends and all other tasks have stopped referencing them. The association between a task and a table is maintained only for the life of a single Transact-SQL statement. This means that a global temporary table is dropped at the completion of the last Transact-SQL statement that was actively referencing the table when the creating session ended.

Can you run your code in debug and check this out?|||I think that Nigel is right. Once the batch completes the local temp table is dropped. If you want to return the entries from your temp it would be better to put all the SQL statements in a SP that returns your recordset (use ADODB command object)

Originally posted by Paul Young
nigelrivett Not exactly try the following, works just fine.

create table #Tmp(f1 int)
go
insert into #Tmp values(1)
go
select * from #Tmp
go

Sia Okay, this is just a guess but what happens if you run profiler as you step through your code? I am thinking that the temp table is alive until you execute the "Set Rs = Nothing". I think this implicitly (sp?) closes the connection and as a result your temp table goes away.

Here is a blerb from BOL:

Temporary tables are automatically dropped when they go out of scope, unless explicitly dropped using DROP TABLE:

A local temporary table created in a stored procedure is dropped automatically when the stored procedure completes. The table can be referenced by any nested stored procedures executed by the stored procedure that created the table. The table cannot be referenced by the process which called the stored procedure that created the table.

All other local temporary tables are dropped automatically at the end of the current session.

Global temporary tables are automatically dropped when the session that created the table ends and all other tasks have stopped referencing them. The association between a task and a table is maintained only for the life of a single Transact-SQL statement. This means that a global temporary table is dropped at the completion of the last Transact-SQL statement that was actively referencing the table when the creating session ended.

Can you run your code in debug and check this out?|||The problem is that the local temp table is accessible only through the SP and not from outside, however the global temp table is accissble from outside.|||Unless a temporary table is created within a stored procedure it persists until it is explicitly dropped or it's connection ends.

The problem is that your code is using a second connection to populate the list box than the one that created the table. If you have an adp project, you shouldn't have to make a new connection or even create a temporary table. Just set your listbox's source directly, and remember to requery it to show the results:

SQL = SQL & "SELECT distinct dbo.tblContact.ContactID,ISNULL(dbo.tblContact.Fir stName, '') "
SQL = SQL & "+ ' ' + ISNULL(dbo.tblContact.LastName, '') AS [Contact Name]"
SQL = SQL & " FROM dbo.tblContact INNER JOIN dbo.tblProperty ON "
SQL = SQL & "dbo.tblContact.ContactID = dbo.tblProperty.ContactID "
SQL = SQL & "WHERE dbo.tblProperty.Zip in (" & Me!zips & ")Order By [Contact Name]"

Me.MListSource.RowSource = SQL
Me.MListSource.Requery

blindman

Monday, February 13, 2012

Accessing Same Remote Table Form Two Linked Servers Return Different Results

We have two SQL Server 2000 instances A and B, both have
a linked server "NAR" defined to access the same database
also called "NAR" at a third remote SQL Server instance.
But executing the following query returns different
results: A returns NULL result set, while B returns the
expected result set.
The query simply selects the new or updated transactions
in the remote table based on a timestamp.
What could be the reason causing this different result?
What makes things even more complicated is that, While
executing on A, not all dates returns NULL set, some of
the dates return result set just fine. While on B, it
always return expected result set no matter what dates you
set. This is what we expected. But how do you explain this
behavior on A?
Select s.TransID
From NAR.NAR.dbo.StoreTransaction s
Where s.CreateTimeStamp > '2004-03-02 18:00:00'
And s.CreateTimestamp <= getdate()
OR
s.updateTimeStamp > '2004-03-02 18:00:00'
And s.updateTimestamp <= getdate()- What results do you get if you were to execute that query on NAR itself?
Same results as from B?
- Have you tried using OPENQUERY when running the query from A to see what
results you get?
- Another suggestion might be to run a profiler trace when the query is
being executed from A->NAR and B->NAR and check for differences.
Vikram Jayaram
Microsoft, SQL Server
This posting is provided "AS IS" with no warranties, and confers no rights.
Subscribe to MSDN & use http://msdn.microsoft.com/newsgroups.|||Thank you for your reply, I posted the problem in many places and to
many so-called SQL experts, nobody replied so far except for you.
Regarding your suggestion:
- What results do you get if you were to execute that query on NAR
itself?
Good point! It occurred to me last week that it may be a problem on NAR
itself. And IT IS! I ran the query in SQL ANALYZER of NAR instance
changing the from clause to reference table StoreTransaction directly,
what is interesting is:
Select count(*) returns correct number in a few seconds, but, select any
column or run all listed columnsreturns NULL after running for almost 2
minutes.
e.g, select count(*) OR Select count(Transid)
returns correct number, select Transid returns NULL.
The from and where clause is exactly the same.
And this problem can be found only on certain dates. For example, Mar.
22 is not OK, but March 23 is fine.
It seems to be data related, but how do you explain aggregate returns
corerct results?
- Have you tried using OPENQUERY when running the query from A to see
what
results you get?
How do I use OPENQUERY in SQL ANALYZER?
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!

Accessing reports through URL

Hello, All !!

I'm now getting problems with access reports through URL.
The situation is:
I'm posting the form to the frame, action attribute's URL includes
querystring.
Also I have some inputs in the form.
I'm using method=post.

Problem is that Report Server ignores parameters from query of the action.

I think it should work with them but it doesn't.

If anyone knows what's the matter here, please !

Thank you,
Alexander Yaremchuk

What version of the SQL RS are you using. The latest SQL 2005 CTP drop had this bug, which has been fixed since then.
Thanks
Tudor

Sunday, February 12, 2012

Accessing Remotely located SQL Server via Access

Hi,

I need the code to create a connection between the Sql server using ACCESS form.

Can I do this. If yes . can you help mw with it.

Currently I am accessing the server with remote desktop connection

Regards,

Jay

There is a fairly useful resource for this process in Access help under "Import or link SQL database tables or data from other ODBC data sources". Just search for that string in Access help, and there will be a whole bunch of information on this topic. Hopefully, this will provide you with all you need to connect to SQL server.

Hope this helps!

John (MSFT)

|||

There is a fairly useful resource for this process in Access help under "Import or link SQL database tables or data from other ODBC data sources". Just search for that string in Access help, and there will be a whole bunch of information on this topic. Hopefully, this will provide you with all you need to connect to SQL server.

Hope this helps!

John (MSFT)

|||

Open the destination database (access database which you want linked to SQL Server)
On the External Data tab, in the Import group, click More.
Click ODBC Database.
Click Link to the data source by creating a linked table, and then click OK.

Click New to create a new data source name (DSN).
The Create New Data Source Wizard starts.

In the wizard, select SQL Server in the list of drivers, and then click Next.

Click Next, review the summary information, and then click Finish to complete the Create New Data Source Wizard.
The Create a New Data Source to SQL Server Wizard starts.

In the wizard, type a description of the data source in the Description box. This step is optional.
Under Which SQL Server do you want to connect to, in the Server box, type or select the name of the SQL Server computer to which you want to connect, and then click Next to continue.
On this page of the wizard, you might need to get information from the SQL Server database administrator, such as whether to use Windows NT authentication or SQL Server authentication. Click Next to continue.
On the next page of the wizard, you might need to get more information from the SQL Server database administrator. If you want to connect to a specific database, ensure that the Change the default database to check box is selected, select the SQL Server database that you want to work with, and then click Next.
Click Finish. Review the summary information, and then click Test Data Source.
Review the test results, and then click OK to close the SQL Server ODBC Data Source Test dialog box.
If the test was successful, click OK again to complete the wizard, or click Cancel to return to the wizard and make changes to your settings.


Click OK.
Access displays the Link Tables dialog box.

Under Tables, click each table or view that you want to link to, and then click OK.

Regards,

Designing-Systems.com