Showing posts with label net. Show all posts
Showing posts with label net. Show all posts

Tuesday, March 27, 2012

@@Identity not returning Value

I have a stored procedure that inserts a record. I call the @.@.Identity variable and assign that to a variable in my SQL statement in my asp.net page.

That all worked fine when i did it just like that. Now I'm using a new stored procedure that inserts records into 3 tables successively, and the value of the @.@.Identity field is no longer being returned.

As you can see below, since I don't want the identity field value of the 2 latter records, I call for that value immediately after the first insert. I then use the value to populate the other 2 tables. I just can't figure out why the value is not being returned to my asp.net application. Think there's something wrong with the SP or no?

When I pass the value of the TicketID variable to a text field after the insert, it gives me "@.TicketID".

Anyone have any ideas?


CREATE PROCEDURE [iguser].[newticket]
(
@.Category nvarchar(80),
@.Description nvarchar(200),
@.Detail nvarchar(3000),
@.OS nvarchar(150),
@.Browser nvarchar(250),
@.Internet nvarchar(100),
@.Method nvarchar(50),
@.Contacttime nvarchar(50),
@.Knowledge int,
@.Importance int,
@.Sendcopy bit,
@.Updateme bit,
@.ClientID int,
@.ContactID int,
@.TicketID integer OUTPUT
)
AS

INSERT INTO Tickets
(
Opendate,
Category,
Description,
Detail,
OS,
Browser,
Internet,
Method,
Contacttime,
Knowledge,
Importance,
Sendcopy,
Updateme
)
VALUES
(
Getdate(),
@.Category,
@.Description,
@.Detail,
@.OS,
@.Browser,
@.Internet,
@.Method,
@.Contacttime,
@.Knowledge,
@.Importance,
@.Sendcopy,
@.Updateme
)
SELECT
@.TicketID = @.@.Identity

INSERT INTO Contacts_to_Tickets
(
U2tUserID,
U2tTicketID
)
VALUES
(
@.ContactID,
@.TicketID
)

INSERT INTO Clients_to_Tickets
(
C2tClientID,
C2tTicketID
)
VALUES
(
@.ClientID,
@.TicketID
)

Fixed the problem, it was with my .net code|||The best practice is to constrain, you should use IDENT_CURRENT('Tickets') instead of @.@.IDENTITY when you are inserting into multiple tables. IDENT_CURRENT gives you the last Identity generated in a specific table, as @.@.IDENTITY has no constraint and returns the last Identity of any table in the session or scope.

Based on your execution @.@.IDENTITY will work, but I figured I would throw this out there anyway.

Sunday, March 25, 2012

Data transfer Pocket PC <> Desktop PC?

Hi,everyone!

I'm new to this forum and also new to Visual Studio 2005 .NET.

I'm going to develop a pocket pc(windows mobile 2005) application which needs to save some data introduced by the user.Later that data should be syncronized with MS SQL Server database.

The application is going to be developed using Visual Studio 2005 with c#.

So I'm doubting wich is the best way of syncronising the data between Pocket Pc and a Desktop PC.Should i use MS SQL Server Mobile(RDA,Merge Replication) or XML(Xml Web Services) would help me better?Or is there any other better way of data syncronization/storage?

Could anyone help me,or post some links + code samples,please?

Thanks!

You'll need to provide more information ... how much data? What sort of data? Will it need to be wrapped in a transaction and/or have other potential for rollback? How critical is it/how reliable does the synchronization need to be? Have you looked into the Service Broker? (I'm exploring this for a project myself.)

Thursday, March 22, 2012

Embed PDF inside of SQL Server Report Servics Report

Hi ...

I posted this same question on the ASP.NET forum and haven't received an answer, so I thought I'ld move the discussion over to this forum. My question has been read several times, so I know I'm not the only one facing this problem, but nobody seems to know how to make it happen.

Anyhow, I'm building a system where we collect a great deal of meta data inside of SQL Server. The meta data is associated wtih files that the users can attach - image files and PDFs. I can get the image files to display properly, however I can find no way to actually display the contents of the PDF file as part of the report.

We want to print out the meta data as a header to the PDF and then print the PDF in it's entirety. As an example, we would print out:

Emergency Plan Name: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Facility Name: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Last Review Date: 99/99/9999 Reviewed By: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

HERE IS WHERE I WOULD WANT TO PRINT OUT THE ASSOCIATED PDF's --

-- Emergency Plan --

-- Evacuation Plan 1 --

-- Evacuation Plan 2 --

I can print the file names - they are fields in the database, but how do I embed the actual PDF in to the report? They can print on different pages - I don't care about that, but I need to get them to be a part of the report.

Thanks ...

David

Any day above ground is a good day!

It's not possible to embed a PDF in a RS report.

If they're single page PDF's then you could try and code something clever that outputs them as images and embed the images.

Other than that I don't see a way of doing this.

|||Ok, so there is no built in functionality to handle embedding and outputting PDF's within reports built via SSRS. Has anyone seen any Custom Report Items that have been built that would allow me to have PDF's print in-line as part of the report?

Thanks ...

David
Any day above ground is a good day!|||

Beyond PDF embedding - where is a good site to review Custom Report Items? Either for purchase or open source?

Thanks ...

David

Any day above ground is a good day!

sql

Monday, March 19, 2012

.SQL file

I have install.sql, that i want to run...so I can add to my existing asp.net 2.0 project. How do can I add the table to my database using that file (contents below)? Database resides in SQL Server 2000.

create table[dbo].[CustomProfile](

[UserID] [uniqueidentifier]not null,

[FirstName] [nvarchar](25)not null,

[LastName] [nvarchar](25)not null,

[Address1] [nvarchar](75)not null,

[Address2] [nvarchar](75)null,

[City] [nvarchar](50)not null,

[State] [nvarchar](2)not null,

[Zip] [nvarchar](10)not null,

[Phone] [nvarchar](12)null,

[ProfileVersion] [int]not null,

[LastUpdatedDate] [datetime]not null

)on[PRIMARY]

alter table[dbo].[CustomProfile]add

constraint[PK_CustomProfile_UserProfile]primary key clustered

(

[UserID]

)with(IGNORE_DUP_KEY =OFF)on[PRIMARY]

Easiest way is to run it in the Query Analyzer. Open up SQL management tools, connect to the sevrver/db of your choice. Then you start the Query Analyzer (or new Query if it's 2005) from a menu. There you can paste the code and just click the green arrow to execute it. Voila!

|||

Thanks for the suggestion. However, I got the following error listed below. Any idea?

Msg 170, Level 15, State 1, Line 19

Line 19: Incorrect syntax near '('.

|||

I removed 'with(IGNORE_DUP_KEY =OFF)on[PRIMARY]'....and it worked. Is this not an SQL option?

Thanks again for your help.

|||

johram:

Easiest way is to run it in the Query Analyzer. Open up SQL management tools, connect to the sevrver/db of your choice. Then you start the Query Analyzer (or new Query if it's 2005) from a menu. There you can paste the code and just click the green arrow to execute it. Voila!

In a perfect world, perhaps...Wink

The OP is saying he needs to create the table on SQL 2000. The script wil fail at the end ".. WITH (IGNORE_DUP_KEY).. " part. This is 2005 syntax. I believe the script was generated from Management Studio connected to 2000 box?

Sunday, March 11, 2012

.NET, SQL, and firewall

We're having a problem with a local intranet site and SQL. The web server
sits behind a firewall. There is an instance of SQL on it with one, primary
database with users, permissions, and roles types of data. The main SQL
server sits on the network domain. Each SQL instance links to the other.
The PROBLEM is that when traffic is heavy on the site, the web server SQL
will sometimes "Lock up", failing to return queries. Restarting the MSSQL
service on the web server always corrects the problem, but we shouldn't be
having it. Anyone recognize the symptoms?
--
Thanks,
CGWUsing Task Manager check what process is taking all the CPU.
I've had a problem with a client where their firewall could only handle say
2Mbits/second which is quite small considering it was an intranet
application with lots of clients, so the bottleneck looked like SQL not
handling the load, but it was actually the firewall.
If you need to go through a firewall to go from the web box through to the
SQL box check what bandwidth it can handle and then check how much the
network between them is utilised.
Tony.
--
Tony Rogerson
SQL Server MVP
http://sqlserverfaq.com - free video tutorials
"CGW" <CGW@.discussions.microsoft.com> wrote in message
news:6E9E95C2-765F-4772-B15C-82678F955255@.microsoft.com...
> We're having a problem with a local intranet site and SQL. The web server
> sits behind a firewall. There is an instance of SQL on it with one,
> primary
> database with users, permissions, and roles types of data. The main SQL
> server sits on the network domain. Each SQL instance links to the other.
> The PROBLEM is that when traffic is heavy on the site, the web server SQL
> will sometimes "Lock up", failing to return queries. Restarting the MSSQL
> service on the web server always corrects the problem, but we shouldn't be
> having it. Anyone recognize the symptoms?
> --
> Thanks,
> CGW|||Amazing. Our dept head guessed it could be the firewall, but I had my doubts
since the instance of SQL we seemed to be having trouble with sits on the
same machine (and same side of the firewall) as the .NET application. <Bad
form for the boss to be right, but then he often is>. Thanks for the help.
We'll check it out.
--
Thanks,
CGW
"Tony Rogerson" wrote:
> Using Task Manager check what process is taking all the CPU.
> I've had a problem with a client where their firewall could only handle say
> 2Mbits/second which is quite small considering it was an intranet
> application with lots of clients, so the bottleneck looked like SQL not
> handling the load, but it was actually the firewall.
> If you need to go through a firewall to go from the web box through to the
> SQL box check what bandwidth it can handle and then check how much the
> network between them is utilised.
> Tony.
> --
> Tony Rogerson
> SQL Server MVP
> http://sqlserverfaq.com - free video tutorials
>
> "CGW" <CGW@.discussions.microsoft.com> wrote in message
> news:6E9E95C2-765F-4772-B15C-82678F955255@.microsoft.com...
> > We're having a problem with a local intranet site and SQL. The web server
> > sits behind a firewall. There is an instance of SQL on it with one,
> > primary
> > database with users, permissions, and roles types of data. The main SQL
> > server sits on the network domain. Each SQL instance links to the other.
> >
> > The PROBLEM is that when traffic is heavy on the site, the web server SQL
> > will sometimes "Lock up", failing to return queries. Restarting the MSSQL
> > service on the web server always corrects the problem, but we shouldn't be
> > having it. Anyone recognize the symptoms?
> > --
> > Thanks,
> >
> > CGW
>
>|||Your welcome.
I think it's one of those ticking time bombs - I bet there are a lot of
installations that have the same problem but they don't know (yet anyway).
Its quite easy to miss.
--
Tony Rogerson
SQL Server MVP
http://sqlserverfaq.com - free video tutorials
"CGW" <CGW@.discussions.microsoft.com> wrote in message
news:50E86CDF-E776-4A04-B8AF-DF39B7B2A886@.microsoft.com...
> Amazing. Our dept head guessed it could be the firewall, but I had my
> doubts
> since the instance of SQL we seemed to be having trouble with sits on the
> same machine (and same side of the firewall) as the .NET application. <Bad
> form for the boss to be right, but then he often is>. Thanks for the help.
> We'll check it out.
> --
> Thanks,
> CGW
>
> "Tony Rogerson" wrote:
>> Using Task Manager check what process is taking all the CPU.
>> I've had a problem with a client where their firewall could only handle
>> say
>> 2Mbits/second which is quite small considering it was an intranet
>> application with lots of clients, so the bottleneck looked like SQL not
>> handling the load, but it was actually the firewall.
>> If you need to go through a firewall to go from the web box through to
>> the
>> SQL box check what bandwidth it can handle and then check how much the
>> network between them is utilised.
>> Tony.
>> --
>> Tony Rogerson
>> SQL Server MVP
>> http://sqlserverfaq.com - free video tutorials
>>
>> "CGW" <CGW@.discussions.microsoft.com> wrote in message
>> news:6E9E95C2-765F-4772-B15C-82678F955255@.microsoft.com...
>> > We're having a problem with a local intranet site and SQL. The web
>> > server
>> > sits behind a firewall. There is an instance of SQL on it with one,
>> > primary
>> > database with users, permissions, and roles types of data. The main SQL
>> > server sits on the network domain. Each SQL instance links to the
>> > other.
>> >
>> > The PROBLEM is that when traffic is heavy on the site, the web server
>> > SQL
>> > will sometimes "Lock up", failing to return queries. Restarting the
>> > MSSQL
>> > service on the web server always corrects the problem, but we shouldn't
>> > be
>> > having it. Anyone recognize the symptoms?
>> > --
>> > Thanks,
>> >
>> > CGW
>>

.NET, SQL, and firewall

We're having a problem with a local intranet site and SQL. The web server
sits behind a firewall. There is an instance of SQL on it with one, primary
database with users, permissions, and roles types of data. The main SQL
server sits on the network domain. Each SQL instance links to the other.
The PROBLEM is that when traffic is heavy on the site, the web server SQL
will sometimes "Lock up", failing to return queries. Restarting the MSSQL
service on the web server always corrects the problem, but we shouldn't be
having it. Anyone recognize the symptoms?
--
Thanks,
CGWUsing Task Manager check what process is taking all the CPU.
I've had a problem with a client where their firewall could only handle say
2Mbits/second which is quite small considering it was an intranet
application with lots of clients, so the bottleneck looked like SQL not
handling the load, but it was actually the firewall.
If you need to go through a firewall to go from the web box through to the
SQL box check what bandwidth it can handle and then check how much the
network between them is utilised.
Tony.
Tony Rogerson
SQL Server MVP
http://sqlserverfaq.com - free video tutorials
"CGW" <CGW@.discussions.microsoft.com> wrote in message
news:6E9E95C2-765F-4772-B15C-82678F955255@.microsoft.com...
> We're having a problem with a local intranet site and SQL. The web server
> sits behind a firewall. There is an instance of SQL on it with one,
> primary
> database with users, permissions, and roles types of data. The main SQL
> server sits on the network domain. Each SQL instance links to the other.
> The PROBLEM is that when traffic is heavy on the site, the web server SQL
> will sometimes "Lock up", failing to return queries. Restarting the MSSQL
> service on the web server always corrects the problem, but we shouldn't be
> having it. Anyone recognize the symptoms?
> --
> Thanks,
> CGW|||Amazing. Our dept head guessed it could be the firewall, but I had my doubts
since the instance of SQL we seemed to be having trouble with sits on the
same machine (and same side of the firewall) as the .NET application. <Bad
form for the boss to be right, but then he often is>. Thanks for the help.
We'll check it out.
--
Thanks,
CGW
"Tony Rogerson" wrote:

> Using Task Manager check what process is taking all the CPU.
> I've had a problem with a client where their firewall could only handle sa
y
> 2Mbits/second which is quite small considering it was an intranet
> application with lots of clients, so the bottleneck looked like SQL not
> handling the load, but it was actually the firewall.
> If you need to go through a firewall to go from the web box through to the
> SQL box check what bandwidth it can handle and then check how much the
> network between them is utilised.
> Tony.
> --
> Tony Rogerson
> SQL Server MVP
> http://sqlserverfaq.com - free video tutorials
>
> "CGW" <CGW@.discussions.microsoft.com> wrote in message
> news:6E9E95C2-765F-4772-B15C-82678F955255@.microsoft.com...
>
>|||Your welcome.
I think it's one of those ticking time bombs - I bet there are a lot of
installations that have the same problem but they don't know (yet anyway).
Its quite easy to miss.
Tony Rogerson
SQL Server MVP
http://sqlserverfaq.com - free video tutorials
"CGW" <CGW@.discussions.microsoft.com> wrote in message
news:50E86CDF-E776-4A04-B8AF-DF39B7B2A886@.microsoft.com...[vbcol=seagreen]
> Amazing. Our dept head guessed it could be the firewall, but I had my
> doubts
> since the instance of SQL we seemed to be having trouble with sits on the
> same machine (and same side of the firewall) as the .NET application. <Bad
> form for the boss to be right, but then he often is>. Thanks for the help.
> We'll check it out.
> --
> Thanks,
> CGW
>
> "Tony Rogerson" wrote:
>

.NET, SQL, and firewall

We're having a problem with a local intranet site and SQL. The web server
sits behind a firewall. There is an instance of SQL on it with one, primary
database with users, permissions, and roles types of data. The main SQL
server sits on the network domain. Each SQL instance links to the other.
The PROBLEM is that when traffic is heavy on the site, the web server SQL
will sometimes "Lock up", failing to return queries. Restarting the MSSQL
service on the web server always corrects the problem, but we shouldn't be
having it. Anyone recognize the symptoms?
Thanks,
CGW
Using Task Manager check what process is taking all the CPU.
I've had a problem with a client where their firewall could only handle say
2Mbits/second which is quite small considering it was an intranet
application with lots of clients, so the bottleneck looked like SQL not
handling the load, but it was actually the firewall.
If you need to go through a firewall to go from the web box through to the
SQL box check what bandwidth it can handle and then check how much the
network between them is utilised.
Tony.
Tony Rogerson
SQL Server MVP
http://sqlserverfaq.com - free video tutorials
"CGW" <CGW@.discussions.microsoft.com> wrote in message
news:6E9E95C2-765F-4772-B15C-82678F955255@.microsoft.com...
> We're having a problem with a local intranet site and SQL. The web server
> sits behind a firewall. There is an instance of SQL on it with one,
> primary
> database with users, permissions, and roles types of data. The main SQL
> server sits on the network domain. Each SQL instance links to the other.
> The PROBLEM is that when traffic is heavy on the site, the web server SQL
> will sometimes "Lock up", failing to return queries. Restarting the MSSQL
> service on the web server always corrects the problem, but we shouldn't be
> having it. Anyone recognize the symptoms?
> --
> Thanks,
> CGW
|||Amazing. Our dept head guessed it could be the firewall, but I had my doubts
since the instance of SQL we seemed to be having trouble with sits on the
same machine (and same side of the firewall) as the .NET application. <Bad
form for the boss to be right, but then he often is>. Thanks for the help.
We'll check it out.
Thanks,
CGW
"Tony Rogerson" wrote:

> Using Task Manager check what process is taking all the CPU.
> I've had a problem with a client where their firewall could only handle say
> 2Mbits/second which is quite small considering it was an intranet
> application with lots of clients, so the bottleneck looked like SQL not
> handling the load, but it was actually the firewall.
> If you need to go through a firewall to go from the web box through to the
> SQL box check what bandwidth it can handle and then check how much the
> network between them is utilised.
> Tony.
> --
> Tony Rogerson
> SQL Server MVP
> http://sqlserverfaq.com - free video tutorials
>
> "CGW" <CGW@.discussions.microsoft.com> wrote in message
> news:6E9E95C2-765F-4772-B15C-82678F955255@.microsoft.com...
>
>
|||Your welcome.
I think it's one of those ticking time bombs - I bet there are a lot of
installations that have the same problem but they don't know (yet anyway).
Its quite easy to miss.
Tony Rogerson
SQL Server MVP
http://sqlserverfaq.com - free video tutorials
"CGW" <CGW@.discussions.microsoft.com> wrote in message
news:50E86CDF-E776-4A04-B8AF-DF39B7B2A886@.microsoft.com...[vbcol=seagreen]
> Amazing. Our dept head guessed it could be the firewall, but I had my
> doubts
> since the instance of SQL we seemed to be having trouble with sits on the
> same machine (and same side of the firewall) as the .NET application. <Bad
> form for the boss to be right, but then he often is>. Thanks for the help.
> We'll check it out.
> --
> Thanks,
> CGW
>
> "Tony Rogerson" wrote:

.NET Windows Forms Application VS MS Access client Application

SQL Server will be used as the back-end database to a non trivial client
application.
In question is the choice of client application:
I need to be able to speak intelligently about when one client (MS Access vs
.NET Windows Forms) would be preferred over the other. While I have some
good arguments on both sides, I would appreciate your points of view on the
topic.
For the sake of this discussion, please assume a *non trivial* client
application with, say 120 forms, secure data processing, hundreds of
reports, and a clear need for a rich UI experience (MDI, a variety of rich
UI controls, non trivial printing requirements, etc).
I would appreciate help in compiling arguments both for and against each
technology (MS Access and .NET Windows Forms) as a client application.
So far I have this (in no particular order):
BENEFITS OF a .NET Windows Forms Application:
1. Client can be MDI (whereas Access only SDI)
2. Much richer UI with .NET (vs MS Access UI controls)
3. Easier deployment (with ClickOnce, XCopy, and similar .NET technologies
or methods). The client already has the CLR installed as part of their
standard desktop image - so I need to put nothing more than "XCopy" the
application files onto the local machine.
4. .NET requires a smaller footprint on the client with respect to the use
of 3rd party UI controls. MS Access is a COM-based technology and therefore
requires that 3rd party controls be COM controls. These require installation
to Windows\System32 and associated updates to the Registry (whereas .NET 3rd
party controls require only XCopy deployment to the application folder)
5. 3rd party UI controls for .NET are more prevalent, capable, and rich than
3rd party COM controls. Plus support for COM controls (i.e. number of 3rd
party companies making and supporting them) is expected to only decrease,
not increase, during the coming years - with the exact opposite trend
expected for 3rd party .NET controls.
6. .NET Windows Forms applications can take full advantage of OOP constructs
and patterns - thereby enabling the developers to create applications that
are easier to maintain, more easily extensible, and better architected than
the "equivalent" functionality provided in an MS Access application.
7. Visual Studio .NET significantly increases developer productivity (vs MS
Access support for application development)
8. The .NET base classes significantly increase developer productivity by
pre-packing substantial functionality that would have to be coded from
scratch in MS Access.
9. Runtime performance of a .NET application would likely be faster than MS
Access because MS Access (really Jet) necessarily entails a file server
architecture, while ADO.NET necessarily entails a distributed (and
disconnected) architecture.
10. ADO.NET takes care of connection pooling automatically and provides a
huge amount of built-in functionality that substantially increases developer
productivity and increases programmer control over database communications
and updates (as compared to JET and DAO).
DOWNSIDE OF a .NET Windows Forms Application:
1. Increased expertise required for .NET development - vs. MS Access (at
least that's the perception of the client)
2. Requires the target version of the CLR to be installed on the client
machines (leading possibly to multiple versions of the .NET Framework
installed simultaneously. Not that I have a problem with it, but their
desktop support folks might).
BENEFITS OF a .MS Access Client Application:
1. Less expertise required on the part of the developers (at least that's
the perception of the client).
2. Out of the box it includes many useful UI controls and a first-class
report writer.
DOWNSIDE OF a .MS Access Client Application:
1. Insert right here THE EXACT OPPOSITE of all of the benefits of a .NET
Windows Forms application, then:
2. The client machine must have the correct version of MS Access installed
(i.e. they're stuck with a particular version, or all must upgrade
simultaneously).
3. Passthrough queries would be required in order to get the query
processing to happen on the server. Passthrough queries ential some
additional complexity than non passthrough queries.
4. Without the use of passthrough queries, SQL Server's locking mechanisms
can behave unexpectedly (e.g., locks can unexpectedly be placed on tables
rather than pages or rows) - thereby resulting in slower performance.
5. Date processing logic is less secure because users can, relatively
easily, view and modify the client-side code and/or queries.
Any additions to these lists are greatly appreciated!
JordanThat's amusing. I won't attempt to correct your opinions,
but note that you haven't addressed reporting yet. I've
used Crystal, Access, and Report Services, and my opinion
is that you really need to accommodate the skill set of your
developers.
(david)
"Jordan S." <A@.B.COM> wrote in message
news:%23iVVsYoXGHA.196@.TK2MSFTNGP04.phx.gbl...
> SQL Server will be used as the back-end database to a non trivial client
> application.
> In question is the choice of client application:
> I need to be able to speak intelligently about when one client (MS Access
> vs .NET Windows Forms) would be preferred over the other. While I have
> some good arguments on both sides, I would appreciate your points of view
> on the topic.
> For the sake of this discussion, please assume a *non trivial* client
> application with, say 120 forms, secure data processing, hundreds of
> reports, and a clear need for a rich UI experience (MDI, a variety of rich
> UI controls, non trivial printing requirements, etc).
> I would appreciate help in compiling arguments both for and against each
> technology (MS Access and .NET Windows Forms) as a client application.
> So far I have this (in no particular order):
> BENEFITS OF a .NET Windows Forms Application:
> 1. Client can be MDI (whereas Access only SDI)
> 2. Much richer UI with .NET (vs MS Access UI controls)
> 3. Easier deployment (with ClickOnce, XCopy, and similar .NET technologies
> or methods). The client already has the CLR installed as part of their
> standard desktop image - so I need to put nothing more than "XCopy" the
> application files onto the local machine.
> 4. .NET requires a smaller footprint on the client with respect to the use
> of 3rd party UI controls. MS Access is a COM-based technology and
> therefore requires that 3rd party controls be COM controls. These require
> installation to Windows\System32 and associated updates to the Registry
> (whereas .NET 3rd party controls require only XCopy deployment to the
> application folder)
> 5. 3rd party UI controls for .NET are more prevalent, capable, and rich
> than 3rd party COM controls. Plus support for COM controls (i.e. number of
> 3rd party companies making and supporting them) is expected to only
> decrease, not increase, during the coming years - with the exact opposite
> trend expected for 3rd party .NET controls.
> 6. .NET Windows Forms applications can take full advantage of OOP
> constructs and patterns - thereby enabling the developers to create
> applications that are easier to maintain, more easily extensible, and
> better architected than the "equivalent" functionality provided in an MS
> Access application.
> 7. Visual Studio .NET significantly increases developer productivity (vs
> MS Access support for application development)
> 8. The .NET base classes significantly increase developer productivity by
> pre-packing substantial functionality that would have to be coded from
> scratch in MS Access.
> 9. Runtime performance of a .NET application would likely be faster than
> MS Access because MS Access (really Jet) necessarily entails a file server
> architecture, while ADO.NET necessarily entails a distributed (and
> disconnected) architecture.
> 10. ADO.NET takes care of connection pooling automatically and provides a
> huge amount of built-in functionality that substantially increases
> developer productivity and increases programmer control over database
> communications and updates (as compared to JET and DAO).
> DOWNSIDE OF a .NET Windows Forms Application:
> 1. Increased expertise required for .NET development - vs. MS Access (at
> least that's the perception of the client)
> 2. Requires the target version of the CLR to be installed on the client
> machines (leading possibly to multiple versions of the .NET Framework
> installed simultaneously. Not that I have a problem with it, but their
> desktop support folks might).
> BENEFITS OF a .MS Access Client Application:
> 1. Less expertise required on the part of the developers (at least that's
> the perception of the client).
> 2. Out of the box it includes many useful UI controls and a first-class
> report writer.
> DOWNSIDE OF a .MS Access Client Application:
> 1. Insert right here THE EXACT OPPOSITE of all of the benefits of a .NET
> Windows Forms application, then:
> 2. The client machine must have the correct version of MS Access installed
> (i.e. they're stuck with a particular version, or all must upgrade
> simultaneously).
> 3. Passthrough queries would be required in order to get the query
> processing to happen on the server. Passthrough queries ential some
> additional complexity than non passthrough queries.
> 4. Without the use of passthrough queries, SQL Server's locking mechanisms
> can behave unexpectedly (e.g., locks can unexpectedly be placed on tables
> rather than pages or rows) - thereby resulting in slower performance.
> 5. Date processing logic is less secure because users can, relatively
> easily, view and modify the client-side code and/or queries.
> Any additions to these lists are greatly appreciated!
> Jordan
>|||Thanks for your perspective. Skill set of the developers is very important
as you mentioned, and a shorter learning curve on Access may be relevant to
the final decision.
Please feel free to add to the lists - *all* sides must be represented.|||Why do you say that Access is only SDI? You can open multiple forms,
each one individually resizable & repositionable within the Access
application window. Sounds like MDI, to me!
One of the primary advantages of Access, IMO, is its data-bound
controls. You don't need any code at all, to bind a control to a field
in the data source of a form or report.
As for the rest, IMHO you are asking too much from a newsgroup staffed
by volunteers. It would be a non-trivial consulting task to provide the
detailed comparative report that you want. And you'd really want it to
be done by someone who was expert in both technologies (winforms and
Access). Otherwise, it's too easy for the winforms person to slag
Access (through lack of knowledge of the product), and vice versa.
HTH,
TC (MVP Access)
http://tc2.atspace.com|||It just frightens me that anyone would even consider using MS Access as
anything other than a torture device. Your point #6 for .NET benefits
is very important, and could easily be split out into about 20.
When the application needs to change to do some extra functionality
like access a web service, or perform complex operations on your data
then you would start crying if you were using access. An application
with 120 forms is probably going to have some seriously complex
requirement changes coming out that you won't find out about until mid
way through developing it (usually when the client actually sees a
screen working then says "oh, but if it's a saturday and it's raining
we don't do it like that"). You'll need the ability to put in some
serious design patterns that permit you to change this without having
to re-structure everything.|||Nonsense. A well designed & written systems can generally be enhanced
without much trouble. A badly designed & written system can't. The
workman has much more effect on this, than the tool. You could easily
have a well designed & written Access system, that was easy to enhance,
and a badly designed & written .NET system, that was a nightmare to
enhance.
TC (MVP Access)
http://tc2.atspace.com|||"Jordan S." <A@.B.COM> wrote in message
news:%23iVVsYoXGHA.196@.TK2MSFTNGP04.phx.gbl...

> 2. Much richer UI with .NET (vs MS Access UI controls)
While it is true that there is a wider range of controls available in .NET,
Access provides all the controls that a typical data-centric application
really needs.

> 4. .NET requires a smaller footprint on the client with respect to the use
> of 3rd party UI controls. MS Access is a COM-based technology and
> therefore requires that 3rd party controls be COM controls. These require
> installation to Windows\System32 and associated updates to the Registry
> (whereas .NET 3rd party controls require only XCopy deployment to the
> application folder)
See my answer to point 2 above. The availability or otherwise of third-party
controls isn't an issue when you don't need any third-party controls.

> 5. 3rd party UI controls for .NET are more prevalent, capable, and rich
> than 3rd party COM controls. Plus support for COM controls (i.e. number of
> 3rd party companies making and supporting them) is expected to only
> decrease, not increase, during the coming years - with the exact opposite
> trend expected for 3rd party .NET controls.
See answers to 2 and 4 above.

> 7. Visual Studio .NET significantly increases developer productivity (vs
> MS Access support for application development)
This has not been my experience.

> 8. The .NET base classes significantly increase developer productivity by
> pre-packing substantial functionality that would have to be coded from
> scratch in MS Access.
This has not been my experience.

> 9. Runtime performance of a .NET application would likely be faster than
> MS Access because MS Access (really Jet) necessarily entails a file server
> architecture, while ADO.NET necessarily entails a distributed (and
> disconnected) architecture.
I can't say for sure whether a .NET app is likely to be faster, but I can
say from experience that a well-designed Access app can perform more than
satisfactorily on a LAN.

> 10. ADO.NET takes care of connection pooling automatically and provides a
> huge amount of built-in functionality that substantially increases
> developer productivity and increases programmer control over database
> communications and updates (as compared to JET and DAO).
See answers to 7 and 8 above regarding developer productivity.

> 2. The client machine must have the correct version of MS Access installed
> (i.e. they're stuck with a particular version, or all must upgrade
> simultaneously).
Not necesarily. Access 2002 and 2003 use the same file format by default as
Access 2000. You can run the same MDB under the last three versions of
Access, provided you are careful not to use any new features that were not
supported in Access 2000.

> Any additions to these lists are greatly appreciated!
You haven't mentioned what you're going to use for reporting in .NET. SQL
Server Reporting Services is in many respects, but I miss the tight
integration of the Access report designer and engine, and SQL Server
Reporting Services requires additional installation and configuration on the
server.
Generally speaking, my experience so far is that ASP.NET has been a great
leap forward for Web-based applications, but I remain to be convinced about
the benefits of using Windows Forms for typical data-centric desktop
applications.
Brendan Reynolds
Access MVP|||Fair point that the developer skill is the key factor.
But do you really see Access as a scalable solution for a 120 form
application? I do admit that I've only had a few frustrating encounters
with access forms applications, however it seemed to me that while
their databound controls are their strength for a simple application,
they lack the expressiveness available to .NET controls. I can see the
advantage of access forms if it's managing the database as well, but
when you need to have very particular formatting of your controls, and
tie in to a large variety of events .NET is definitely easier / more
obvious in how to do this.
Secondly, while I do accept that a .NET application can be written
badly, if written well then it will provide a more scalable and
maintainable architecture. I don't believe that Access was designed to
develop complicated middle tier logic, and while it may be possible to
do it in Access, .NET was built with this in mind.
I do agree we shouldn't start bashing other technologies though, so
please ignore my "torture device" comment posted previously|||Will wrote:

> Fair point that the developer skill is the key factor.

> But do you really see Access as a scalable solution for a 120 form application?[/c
olor]
Access can easily handle 120 forms. There'd be squintillions of working
Access databases around the world with that number. However, you're
certainly right, that the number can not grow arbitrarily. So, winforms
might be more scalable here - I don't know.
But it does raise the question, how many is enough? What are all these
forms *for*, in systems that have hundreds & hundreds & hundreds of
forms? Every time I hear of one, I think: "Geez, surely it would be
possible to have a smaller # of forms & let them customize themselves
at runtime".
> I do admit that I've only had a few frustrating encounters
> with access forms applications, however it seemed to me that while
> their databound controls are their strength for a simple application,
> they lack the expressiveness available to .NET controls. I can see the
> advantage of access forms if it's managing the database as well, but
> when you need to have very particular formatting of your controls, and
> tie in to a large variety of events .NET is definitely easier / more
> obvious in how to do this.
It's hard to comment without specifics. You may be right - I don't know
enough about winforms to have an opinion. Certainly the Access event
model has a few deficiencies.

> Secondly, while I do accept that a .NET application can be written
> badly, if written well then it will provide a more scalable and
> maintainable architecture. I don't believe that Access was designed to
> develop complicated middle tier logic, and while it may be possible to
> do it in Access, .NET was built with this in mind.
You may well be right. I don't know enough about .NET & winforms to
have an opinion yet.

> I do agree we shouldn't start bashing other technologies though, so
> please ignore my "torture device" comment posted previously
No probs, thanks for that acknowledgement. I was girding my loins, to
enter the fray!
Cheers,
TC (MVP Access)
http://tc2.atspace.com|||Thanks for your perspective TC.
A couple of thoughts:
RE:
<< It would be a non-trivial consulting task to provide the detailed
comparative report that you want.>>
Exactly! That's my job and that's why I provided the initial lists in the OP
(to get the ball rolling). I hope I provided at least the "big hits" and
that that good folks here in the NG can just scan and say "oh, you missed x,
y, or z".
RE:
<< And you'd really want it to be done by someone who was expert in both
technologies (winforms and Access). >>
That's me to some extent also. FWIW I have 5 years of full-time and non
trivial MS Access programming experience (Access 2.0 through 97), 4 years in
VB, and 3 in .NET. So I can lay claim to some awareness of the strengths of
MS Access, plus some other technologies.
RE:
<< Otherwise, it's too easy for the winforms person to slag Access... and
vice versa >>
I'm not here to bash MS Access nor start any flame war. I'm just recognizing
a situation where it may not be the *best* tool for the job. Rather than
just saying "geeze we shouldn't use Access for non trivial UI programming" I
want to be able to state specifically why. And if I'm wrong in my
assumptions or beliefs then I also want to know specifically why.
Finally, towards avoiding a flame war, I'd like to encourage respondents to
avoid arguing against any points anyone here makes. All are taken as either
[completely valid] or [perceived as valid] and thus are greatly appreciated.
Thanks again!

.net version of Detect Anomalies in Excel

Is there an equivalent or similar .net sample for detecting data Anomalies?

Detect Anomalies in Excel

http://zones.advisor.com/doc/14413

Please check out the Data Mining Addins for Office 2007. There's a task "Detect Outliers" which might work for you. More details about the addins are available at http://www.sqlserverdatamining.com

Thanks

|||I can say that I've never even tried it ... but I would need to obtain the Add-in source code and alter it for my purposes. Office/Excel will not suffice. I need to expose this functionality via a web interface and so it must also be a highly scalable solution. C# preferable.|||

This tip http://www.sqlserverdatamining.com/DMCommunity/TipsNTricks/861.aspx gives the basic idea. You can also check out the live sample at http://www.sqlserverdatamining.com/DMCommunity/LiveSamples/46.aspx that shows anomaly detection in a web application - source code is provided. The Excel Addin adds the automatic creation of a mining model with some nice heuristics for column selection, and the visualization part. Those are mostly dependent on your application and the Excel code wouldn't really help I believe.

The two sources above should give you everything you need. I once presented the implementation of the above web application at TechEd, so it should be in the TechEd archives (although I forget which year it was)

-Jamie

.NET version of DB Hammer

Where can I get .net version of DB Hammer?
J Justin
I need to bulk load my test database with dummy data. SQL Server resource
kit contains tools like DBGen and DBHammer. Is there any .NET version of
these tools?
Thanks for any input.
J Justin
"Justin" <justin@.gjsoft.com> wrote in message
news:#vuucgJ$EHA.3708@.TK2MSFTNGP14.phx.gbl...
> Where can I get .net version of DB Hammer?
> J Justin
>

.net version of crystal reports?

is there a .net version for crystal reports, if i do my reports in 8.5 and load them in a .net application. would it be a problem?
i would be happy if someone could clarify my confusion!
thanksYes there is a .Net version that is supplied with MS Visual Studio .Net. Your 8.5 reports will be fine under CR.Net, but if you create new reports under .Net, you will not be able to open them in 8.5|||who owns the .net version of the crystal reports, is it by microsoft corporation or seagate?|||Beats me :)

.Net trigger, reading all the data

I have a trigger written in C# which I have added to the insert event on a table, however, when testing it generates a "System.Data.SQLClient.SqlException; Cannot use text, ntext, or image columns in the 'inserted' and 'deleted' tables"

My code is attempting to read all the column names & the data contained in them as the record is created, so a solution that allows me to read all the data from each column is what I am after.

Code Extract:

public static void splTrigger()
{
SqlTriggerContext triggContext = SqlContext.TriggerContext;
// string userName, realName;
SqlConnection connection = new SqlConnection("context connection = true");
connection.Open();
SqlCommand command = connection.CreateCommand();
SqlDataReader reader;
string data = "";

switch (triggContext.TriggerAction)
{
case TriggerAction.Insert:
command.CommandText = "SELECT * from " + "inserted";
reader = command.ExecuteReader();
//userName = (string)reader[0];
//realName = (string)reader[1];
// prepare data as name value pairs
for (int i = 0; i < reader.FieldCount; i++)
{
data = data + reader.GetName(i) + ":" + (string)reader[ i ] + " ";
}
break;
...
}}
Did you try to read it from the original table ?

command.CommandText = "SELECT * from Youtable Y INNeR JOIN inserted i on Y.idColumn 0 I.Column";

Jens K. Suessmeyer.

http://www.sqlserver2005.de
|||

As the error suggests, after triggers do not support those datatypes in after triggers (see BOL: Using text, ntext, and image Data in INSTEAD OF Triggers )

Are you able to change the columns with the offending datatypes to the new nvarchar(max), varchar(max), varbinary(max) types?

If not, the join to the original table and selecting the columns from the base table option seems to work nicely.

.Net trigger, reading all the data

I have a trigger written in C# which I have added to the insert event on a table, however, when testing it generates a "System.Data.SQLClient.SqlException; Cannot use text, ntext, or image columns in the 'inserted' and 'deleted' tables"

My code is attempting to read all the column names & the data contained in them as the record is created, so a solution that allows me to read all the data from each column is what I am after.

Code Extract:

public static void splTrigger()
{
SqlTriggerContext triggContext = SqlContext.TriggerContext;
// string userName, realName;
SqlConnection connection = new SqlConnection("context connection = true");
connection.Open();
SqlCommand command = connection.CreateCommand();
SqlDataReader reader;
string data = "";

switch (triggContext.TriggerAction)
{
case TriggerAction.Insert:
command.CommandText = "SELECT * from " + "inserted";
reader = command.ExecuteReader();
//userName = (string)reader[0];
//realName = (string)reader[1];
// prepare data as name value pairs
for (int i = 0; i < reader.FieldCount; i++)
{
data = data + reader.GetName(i) + ":" + (string)reader[ i ] + " ";
}
break;
...
}}
Did you try to read it from the original table ?

command.CommandText = "SELECT * from Youtable Y INNeR JOIN inserted i on Y.idColumn 0 I.Column";

Jens K. Suessmeyer.

http://www.sqlserver2005.de
|||

As the error suggests, after triggers do not support those datatypes in after triggers (see BOL: Using text, ntext, and image Data in INSTEAD OF Triggers )

Are you able to change the columns with the offending datatypes to the new nvarchar(max), varchar(max), varbinary(max) types?

If not, the join to the original table and selecting the columns from the base table option seems to work nicely.

.net StoredProc

Hi,

I'm trying to use a LDAP request to simply fill a table. I want to use the database agent to schedule the insert every night. So I was trying to make a storedproc to do it, but I can't make a import of "System.DirectoryServices". Many references types look to be unavailable. How could I do it ? Some ideas ?
Regards
Jacques

Hi.

I find it easier to create a normal classlib and do the "create assembly", "create function", etc. myself. Your assembly must be marked EXTERNAL_ACCESS.

- Snippet
-- Delete all dependent objects from the assembly
DROP FUNCTION SomeXYZ

-- Drop and recreate the assembly
DROP ASSEMBLY MyImportClr
CREATE ASSEMBLY MyImportClr ...

-- Create the functions
CREATE PROC SomeXYZ EXTERNAL NAME ...

-- Test the new version of my stuff.

- EoSnippet

This is not to everyones taste, of course.
Hope this helps.

|||System.DirectoryServices is not in the SQL Server's supported list of framework libraries. The supported list of libraries have gone through heavy reliability testing to ensure that they are as reliable as other components of SQL Server.
If you want to use System.DirectoryServices you can register it as an unsafe user assembly in your database (as you would do for assemblies that you develop) and use it thereafter:
Create Assembly DirSvc from 'c:\Windows\Microsoft.NET\...\System.DirectoryServices.dll'
with permission_set=unsafe

however, you need to perform adequate reliability testing to make sure that the API's you are using from System.DirectoryServices (or any such non supported assembly) meet the reliability requirements of your application.

Thanks,
-Vineet.|||I'm experiencing a problem with this also. I've added the System.DirectoryServices assembly to SQL Server as UNSAFE (using a command like the one above), and then I've added my assembly (which uses System.DirectoryServices). Since my assembly is strong-named, I didn't use the UNSAFE permission set.

Everything imported fine, but when I try to run a function from my assembly, I get an error that says I don't have permission to access active directory:

System.Security.SecurityException: Request for the permission of type 'System.DirectoryServices.DirectoryServicesPermission, System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' failed.

This assembly runs fine in the development environment, which raises the question - who is this assembly running as when I execute the function from SQL Server? Is it using my trusted login to access active directory, which should work, or is it using a different login, which may not have access to read from AD?

Any help available would be appriciated.|||It is using the account SQL Server runs under. In your code, before the call to AD, try and do an impersonation (look in BOL for SqlContext.WindowsIdentity) and see if that doesn't help.

Niels|||

It turns out that, since I had to import the System.DirectoryServices assembly as "UNSAFE", I couldn't access it from my other assembly, which was imported as "SAFE". In order to access the "UNSAFE" assembly, my assembly also needed to be marked as "UNSAFE".

Not the best solution, but since I'm only doing AD reads and not writes, I'm not worried about the security implications of marking my assembly as UNSAFE. I'm glad the problem is resolved, though I'd like to see System.DirectoryServices, along with other classes from the framework, trusted in future versions of SQL2005. Perhaps we'll get that with SP1.

|||

Thank,

I was able to include the system.directory assembly in the SQL sever, but I can fully work with it.

I use a "DirectoryEntry" in conjunction with a "DirectorySearcher" and when I try to link them, I received a error message. "Unknown mechanism of authentification". I has tried to impersonate and get the same error. The DirectoryEntry look to be initialize correctly, but when I set the Search Root, the DirectoryEntry seam to loose all it's references. Some Ideas ?

There the code :

Dim AdDirEntry As New DirectoryEntry()
Dim MySearcher As New System.DirectoryServices.DirectorySearcher()
Dim WIdentity As WindowsImpersonationContext

WIdentity = SqlContext.WindowsIdentity.Impersonate()

AdDirEntry.Path = LDAP://AdServer
AdDirEntry.Username = "AdUser"
AdDirEntry.Password = "AdPassword"

' Set the research criteria for Active Directory.
MySearcher.SearchRoot = AdDirEntry
MySearcher.PropertiesToLoad.Add("location")
MySearcher.PropertiesToLoad.Add("portName")
MySearcher.PropertiesToLoad.Add("drivername")
MySearcher.PropertiesToLoad.Add("description")
MySearcher.PropertiesToLoad.Add("printername")
MySearcher.PropertiesToLoad.Add("servername")

WIdentity.Undo()

Thank for your help

Jack

.net StoredProc

Hi,

I'm trying to use a LDAP request to simply fill a table. I want to use the database agent to schedule the insert every night. So I was trying to make a storedproc to do it, but I can't make a import of "System.DirectoryServices". Many references types look to be unavailable. How could I do it ? Some ideas ?
Regards
Jacques

Hi.

I find it easier to create a normal classlib and do the "create assembly", "create function", etc. myself. Your assembly must be marked EXTERNAL_ACCESS.

- Snippet
-- Delete all dependent objects from the assembly
DROP FUNCTION SomeXYZ

-- Drop and recreate the assembly
DROP ASSEMBLY MyImportClr
CREATE ASSEMBLY MyImportClr ...

-- Create the functions
CREATE PROC SomeXYZ EXTERNAL NAME ...

-- Test the new version of my stuff.

- EoSnippet

This is not to everyones taste, of course.
Hope this helps.

|||System.DirectoryServices is not in the SQL Server's supported list of framework libraries. The supported list of libraries have gone through heavy reliability testing to ensure that they are as reliable as other components of SQL Server.
If you want to use System.DirectoryServices you can register it as an unsafe user assembly in your database (as you would do for assemblies that you develop) and use it thereafter:
Create Assembly DirSvc from 'c:\Windows\Microsoft.NET\...\System.DirectoryServices.dll'
with permission_set=unsafe

however, you need to perform adequate reliability testing to make sure that the API's you are using from System.DirectoryServices (or any such non supported assembly) meet the reliability requirements of your application.

Thanks,
-Vineet.|||I'm experiencing a problem with this also. I've added the System.DirectoryServices assembly to SQL Server as UNSAFE (using a command like the one above), and then I've added my assembly (which uses System.DirectoryServices). Since my assembly is strong-named, I didn't use the UNSAFE permission set.

Everything imported fine, but when I try to run a function from my assembly, I get an error that says I don't have permission to access active directory:

System.Security.SecurityException: Request for the permission of type 'System.DirectoryServices.DirectoryServicesPermission, System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' failed.

This assembly runs fine in the development environment, which raises the question - who is this assembly running as when I execute the function from SQL Server? Is it using my trusted login to access active directory, which should work, or is it using a different login, which may not have access to read from AD?

Any help available would be appriciated.
|||It is using the account SQL Server runs under. In your code, before the call to AD, try and do an impersonation (look in BOL for SqlContext.WindowsIdentity) and see if that doesn't help.

Niels
|||

It turns out that, since I had to import the System.DirectoryServices assembly as "UNSAFE", I couldn't access it from my other assembly, which was imported as "SAFE". In order to access the "UNSAFE" assembly, my assembly also needed to be marked as "UNSAFE".

Not the best solution, but since I'm only doing AD reads and not writes, I'm not worried about the security implications of marking my assembly as UNSAFE. I'm glad the problem is resolved, though I'd like to see System.DirectoryServices, along with other classes from the framework, trusted in future versions of SQL2005. Perhaps we'll get that with SP1.

|||

Thank,

I was able to include the system.directory assembly in the SQL sever, but I can fully work with it.

I use a "DirectoryEntry" in conjunction with a "DirectorySearcher" and when I try to link them, I received a error message. "Unknown mechanism of authentification". I has tried to impersonate and get the same error. The DirectoryEntry look to be initialize correctly, but when I set the Search Root, the DirectoryEntry seam to loose all it's references. Some Ideas ?

There the code :

Dim AdDirEntry As New DirectoryEntry()
Dim MySearcher As New System.DirectoryServices.DirectorySearcher()
Dim WIdentity As WindowsImpersonationContext
WIdentity = SqlContext.WindowsIdentity.Impersonate()
AdDirEntry.Path = LDAP://AdServer
AdDirEntry.Username = "AdUser"
AdDirEntry.Password = "AdPassword"
' Set the research criteria for Active Directory.
MySearcher.SearchRoot = AdDirEntry
MySearcher.PropertiesToLoad.Add("location")
MySearcher.PropertiesToLoad.Add("portName")
MySearcher.PropertiesToLoad.Add("drivername")
MySearcher.PropertiesToLoad.Add("description")
MySearcher.PropertiesToLoad.Add("printername")
MySearcher.PropertiesToLoad.Add("servername")
WIdentity.Undo()

Thank for your help

Jack

.net StoredProc

Hi,

I'm trying to use a LDAP request to simply fill a table. I want to use the database agent to schedule the insert every night. So I was trying to make a storedproc to do it, but I can't make a import of "System.DirectoryServices". Many references types look to be unavailable. How could I do it ? Some ideas ?
Regards
Jacques

Hi.

I find it easier to create a normal classlib and do the "create assembly", "create function", etc. myself. Your assembly must be marked EXTERNAL_ACCESS.

- Snippet
-- Delete all dependent objects from the assembly
DROP FUNCTION SomeXYZ

-- Drop and recreate the assembly
DROP ASSEMBLY MyImportClr
CREATE ASSEMBLY MyImportClr ...

-- Create the functions
CREATE PROC SomeXYZ EXTERNAL NAME ...

-- Test the new version of my stuff.

- EoSnippet

This is not to everyones taste, of course.
Hope this helps.

|||System.DirectoryServices is not in the SQL Server's supported list of framework libraries. The supported list of libraries have gone through heavy reliability testing to ensure that they are as reliable as other components of SQL Server.
If you want to use System.DirectoryServices you can register it as an unsafe user assembly in your database (as you would do for assemblies that you develop) and use it thereafter:
Create Assembly DirSvc from 'c:\Windows\Microsoft.NET\...\System.DirectoryServices.dll'
with permission_set=unsafe

however, you need to perform adequate reliability testing to make sure that the API's you are using from System.DirectoryServices (or any such non supported assembly) meet the reliability requirements of your application.

Thanks,
-Vineet.|||I'm experiencing a problem with this also. I've added the System.DirectoryServices assembly to SQL Server as UNSAFE (using a command like the one above), and then I've added my assembly (which uses System.DirectoryServices). Since my assembly is strong-named, I didn't use the UNSAFE permission set.

Everything imported fine, but when I try to run a function from my assembly, I get an error that says I don't have permission to access active directory:

System.Security.SecurityException: Request for the permission of type 'System.DirectoryServices.DirectoryServicesPermission, System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' failed.

This assembly runs fine in the development environment, which raises the question - who is this assembly running as when I execute the function from SQL Server? Is it using my trusted login to access active directory, which should work, or is it using a different login, which may not have access to read from AD?

Any help available would be appriciated.|||It is using the account SQL Server runs under. In your code, before the call to AD, try and do an impersonation (look in BOL for SqlContext.WindowsIdentity) and see if that doesn't help.

Niels|||

It turns out that, since I had to import the System.DirectoryServices assembly as "UNSAFE", I couldn't access it from my other assembly, which was imported as "SAFE". In order to access the "UNSAFE" assembly, my assembly also needed to be marked as "UNSAFE".

Not the best solution, but since I'm only doing AD reads and not writes, I'm not worried about the security implications of marking my assembly as UNSAFE. I'm glad the problem is resolved, though I'd like to see System.DirectoryServices, along with other classes from the framework, trusted in future versions of SQL2005. Perhaps we'll get that with SP1.

|||

Thank,

I was able to include the system.directory assembly in the SQL sever, but I can fully work with it.

I use a "DirectoryEntry" in conjunction with a "DirectorySearcher" and when I try to link them, I received a error message. "Unknown mechanism of authentification". I has tried to impersonate and get the same error. The DirectoryEntry look to be initialize correctly, but when I set the Search Root, the DirectoryEntry seam to loose all it's references. Some Ideas ?

There the code :

Dim AdDirEntry As New DirectoryEntry()
Dim MySearcher As New System.DirectoryServices.DirectorySearcher()
Dim WIdentity As WindowsImpersonationContext

WIdentity = SqlContext.WindowsIdentity.Impersonate()

AdDirEntry.Path = LDAP://AdServer
AdDirEntry.Username = "AdUser"
AdDirEntry.Password = "AdPassword"

' Set the research criteria for Active Directory.
MySearcher.SearchRoot = AdDirEntry
MySearcher.PropertiesToLoad.Add("location")
MySearcher.PropertiesToLoad.Add("portName")
MySearcher.PropertiesToLoad.Add("drivername")
MySearcher.PropertiesToLoad.Add("description")
MySearcher.PropertiesToLoad.Add("printername")
MySearcher.PropertiesToLoad.Add("servername")

WIdentity.Undo()

Thank for your help

Jack

.Net Stored Procedures on IA64 SSAS

Does anybody know if it is possible to call .Net stored procedures from a 64 bit Analysis Services Installation? Unfortunately the .Net stored procedures which we are trying to use target the x86 platform and not IA64.

(The procedures use an ODBC driver that is only available to 32 bit applications.)

Any information would be appreciated. The trial and error process gives me an MDX error that says that my stored procedures cannot be found. However, SSAS lets me add the x86 assembly to my database without any problem.

You can't cross 32/64 bit process boundaries within a single process this way. You can't try to load 32bit stored procedure into 64 bit process. Analysis Server is not checking the target platform you compiled you SP for on load, but later as you can see it fails to load it.

If you absolutely must to use the 32bit ODBC driver, you have an option of installing 32bit AS on 64bit platform. But that is highly unintuitive. Take a look if you can find native 64bit version of OLEDB provider instead of using 32bit ODBC driver.

Edward.
--
This posting is provided "AS IS" with no warranties, and confers no rights.

|||I also would like to add here, that unless you are using COM based sprocs (which are off by default), the .NET sprocs are platform agnostic, just like .NET itself. You can take sproc .NET assembly and deploy it to either 32 or 64 bit server without recompilation - it should work fine.

.net Security Exception

I am trying to access a stored proc from windows app (VS 2005 running on windows 2003 server).

The code is

SqlConnection conn = new SqlConnection(sCn);

SqlCommand command = new SqlCommand(sCmd, conn);

SqlDataAdapter adapter = new SqlDataAdapter(command);

DataSet ds = new DataSet();

adapter.Fill(ds, "Location");

this.dg.DataSource = ds;

this.dg.DataMember = "Location";

I get the following exception!!!

System.Security.SecurityException: Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
at System.Security.PermissionSet.Demand()
at System.Data.Common.DbConnectionOptions.DemandPermission()
at System.Data.SqlClient.SqlConnection.PermissionDemand()
at System.Data.SqlClient.SqlConnectionFactory.PermissionDemand(DbConnection outerConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)
at WindowsApplication1.Form1.Form1_Load(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
The action that failed was:
Demand
The type of the first permission that failed was:
System.Data.SqlClient.SqlClientPermission
The Zone of the assembly that failed was:
Internet

What am I doing wrong?

Thanks

SqlCommand command = new SqlCommand(sCmd, conn);

SqlDataAdapter adapter = new SqlDataAdapter(command);

what exactly is command refering to?

Secondly, if it's refering to a networked application, you probably have to publish the assemblies via caspol on the server.

Based on the error, you need to add a key for the Internet codebase.

.NET Runtime Optimization error on SQL Server 2005

I posted this on the .NET Framework inside Sql Server forum as well. Sorry if the cross-post offends anybody.

I upgraded my primary production server this morning to SQL 2005. Everything went fairly smoothly, but a couple of hours after my installation was complete, I found the following error in my event log:

Source: .NET Runtime Optimization Service

EventID: 1101

.NET Runtime Optimization Service (clr_optimization_v2.0.50727_32) - Failed to compile: Microsoft.ReportingServices.QueryDesigners, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91 . Error code = 0x80070002

I am a little stumped since we did not install Reporting Services. We only installed Database Services, Integration Services and Workstation Components. I'm open to any suggestions on this. This does not seem to be negatively affecting our server, but I do want to resolve it as soon as possible.

Thanks,

Kevin

I'm getting the same message. Now I'm unable to modify or create tables.|||Hi,

try to restart the .NET RuntimeOptimization service. If this does not help you can also work without the service temporary. If you have a maintainance windows and can make a reboot of your server, that would be my next step.

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de|||

Hi

I have just installed Reporting Services 2005, SP1, and Rollup fix 2153. Also I have rebooted the machine and I am still getting the event log message which was posted at the beginning of this thread. Do we have a status or resolution for this.

Thanks

Steve

|||Have you try to stop/start ".Net Runtime Optimization Server v2.0.50727_X86" yet? This service usually set to "manual" and not started.|||I have the same problem and none of the above works. Any other ideas from anyone?|||

Hello,

I am running my Asp.Net website on IIS5.1 and Sql Server 2005 for about 6 months now, and it works fine on 3 machines.

I recently installed another machine with identical configuration and created the project from VSS. I get the above error whenever I try to debug. As soon as I start debugging, the .NET Runtime Optimization Service enters stopped state with above error. The following is the exact error in Application Event Viewer:

.NET Runtime Optimization Service (clr_optimization_v2.0.50727_32) - Failed to compile: Microsoft.ReportingServices.QueryDesigners, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91 . Error code = 0x80070002

Any help would be greatly appreciated!!!

|||

We just applied SP1 for SQL Server 2005 on our production server after a successful installation on our test servers and started to get the same error:

.NET Runtime Optimization Service (clr_optimization_v2.0.50727_32) - Failed to compile

We haven't attempted any type of fix yet, waiting to see if anyone else has fixed it yet.

|||

The problem was fixed when I reinstalled Sql Server. Apparently some error during installation, couldnt figure it out.

I think the sequence of installation matters. When I install an XP machine, I stick to the following installation sequence:

Xp->SP2->IIS->MSOffice->OfficeSP->MS Sql Server 2000->Visual Studio->MSDN->VSS->Enterprise Library

Probably This sequence doesnt work for Sql Server 2005

|||Hi
how do you have reinstalled the SQL Server?
Do you have deinstalled/installed the server or how?
We have 3 Instances with diffrent DB′s and i don′t want to crash them.

Thanks for help|||

Best bet is to identify the instance has to be un-installed. In add-remove programs the instances are shown separately. What I did was to stop the sql server in question and save all the LDF and MDF files in a separate folder.

After uninstalling I made sure that corresponding directories and registry entries were completely removed. Then I verified that I am in the correct order, and initiated the installation. I have mentioned the order of installation in my previous message. No need to uninstall .Net framework 2.0 incase already installed. Also, verify that the latest OS service pack is in place before initiate the install.

Once complete, I copied the LDF and MDF files back into the data folder and re-attached the databases. That worked for me.

Hope I have answered your question

|||thanks. but i see that doesn′t work for SQL2k5? We have it :(

regards|||Looks like I am getting this error message after installing service pack 1 on SQL 2005. So uninstall and re-install is the answer? I tried to repair the .NET 2.0 framework, but still get the error. Not sure if this is a show stopper, but this is a new server with fresh install of everything. I would hate to have an error like this cause problems in the future.|||

Hi,

Just come across this after seeing the same error in my event log during standard system reviews. I don't have any noticeable effects, but when reviewing the full sequence of .Net optimisations there are two distinct groupings of compilations, one where the version is clr_optimization_v2.0.50727_32 and one where the version is clr_optimization_v2.0.50727_64 . As I'm running an x64 box might it be that this error is not a problem as it seems to be occuring on the 32bit version of the optimisation and not on the 64bit version?

Would be interesting to know what systems people are running that this error is occuring on, 32bit or 64 bit.

HTH someone else.

Regards

Nick

DBA - United Co-op Ltd

MCDBA

|||

I have the same problem, after Installing SQL 2005 SP1 on Clustermachines.

However my SQL-Cluster has a problem moving groups, which I hold responsible for failing to install the SP1 on the Database Engines.

I have 32 Bit Machines.

I find interesting though that my BTS 2006 Machines that use the SQL Servers have the same Problem too, even they don't have any SQL Server on it themselves.

Is it feasable to believe that the Problem is maybe in some other Patch we installed that affects the SQL Client Components?

I have also installed the Hotfix NDP20-KB918642-X86_bugfix.exe which is supposed to fix the annoying Shim Database Error Message (you know it?).

Any new suggestions, workarounds, patches?

.NET Runtime Optimization error on SQL Server 2005

I posted this on the .NET Framework inside Sql Server forum as well. Sorry if the cross-post offends anybody.

I upgraded my primary production server this morning to SQL 2005. Everything went fairly smoothly, but a couple of hours after my installation was complete, I found the following error in my event log:

Source: .NET Runtime Optimization Service

EventID: 1101

.NET Runtime Optimization Service (clr_optimization_v2.0.50727_32) - Failed to compile: Microsoft.ReportingServices.QueryDesigners, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91 . Error code = 0x80070002

I am a little stumped since we did not install Reporting Services. We only installed Database Services, Integration Services and Workstation Components. I'm open to any suggestions on this. This does not seem to be negatively affecting our server, but I do want to resolve it as soon as possible.

Thanks,

Kevin

I'm getting the same message. Now I'm unable to modify or create tables.|||Hi,

try to restart the .NET RuntimeOptimization service. If this does not help you can also work without the service temporary. If you have a maintainance windows and can make a reboot of your server, that would be my next step.

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de
|||

Hi

I have just installed Reporting Services 2005, SP1, and Rollup fix 2153. Also I have rebooted the machine and I am still getting the event log message which was posted at the beginning of this thread. Do we have a status or resolution for this.

Thanks

Steve

|||Have you try to stop/start ".Net Runtime Optimization Server v2.0.50727_X86" yet? This service usually set to "manual" and not started.|||I have the same problem and none of the above works. Any other ideas from anyone?|||

Hello,

I am running my Asp.Net website on IIS5.1 and Sql Server 2005 for about 6 months now, and it works fine on 3 machines.

I recently installed another machine with identical configuration and created the project from VSS. I get the above error whenever I try to debug. As soon as I start debugging, the .NET Runtime Optimization Service enters stopped state with above error. The following is the exact error in Application Event Viewer:

.NET Runtime Optimization Service (clr_optimization_v2.0.50727_32) - Failed to compile: Microsoft.ReportingServices.QueryDesigners, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91 . Error code = 0x80070002

Any help would be greatly appreciated!!!

|||

We just applied SP1 for SQL Server 2005 on our production server after a successful installation on our test servers and started to get the same error:

.NET Runtime Optimization Service (clr_optimization_v2.0.50727_32) - Failed to compile

We haven't attempted any type of fix yet, waiting to see if anyone else has fixed it yet.

|||

The problem was fixed when I reinstalled Sql Server. Apparently some error during installation, couldnt figure it out.

I think the sequence of installation matters. When I install an XP machine, I stick to the following installation sequence:

Xp->SP2->IIS->MSOffice->OfficeSP->MS Sql Server 2000->Visual Studio->MSDN->VSS->Enterprise Library

Probably This sequence doesnt work for Sql Server 2005

|||Hi
how do you have reinstalled the SQL Server?
Do you have deinstalled/installed the server or how?
We have 3 Instances with diffrent DB′s and i don′t want to crash them.

Thanks for help
|||

Best bet is to identify the instance has to be un-installed. In add-remove programs the instances are shown separately. What I did was to stop the sql server in question and save all the LDF and MDF files in a separate folder.

After uninstalling I made sure that corresponding directories and registry entries were completely removed. Then I verified that I am in the correct order, and initiated the installation. I have mentioned the order of installation in my previous message. No need to uninstall .Net framework 2.0 incase already installed. Also, verify that the latest OS service pack is in place before initiate the install.

Once complete, I copied the LDF and MDF files back into the data folder and re-attached the databases. That worked for me.

Hope I have answered your question

|||thanks. but i see that doesn′t work for SQL2k5? We have it :(

regards
|||Looks like I am getting this error message after installing service pack 1 on SQL 2005. So uninstall and re-install is the answer? I tried to repair the .NET 2.0 framework, but still get the error. Not sure if this is a show stopper, but this is a new server with fresh install of everything. I would hate to have an error like this cause problems in the future.|||

Hi,

Just come across this after seeing the same error in my event log during standard system reviews. I don't have any noticeable effects, but when reviewing the full sequence of .Net optimisations there are two distinct groupings of compilations, one where the version is clr_optimization_v2.0.50727_32 and one where the version is clr_optimization_v2.0.50727_64 . As I'm running an x64 box might it be that this error is not a problem as it seems to be occuring on the 32bit version of the optimisation and not on the 64bit version?

Would be interesting to know what systems people are running that this error is occuring on, 32bit or 64 bit.

HTH someone else.

Regards

Nick

DBA - United Co-op Ltd

MCDBA

|||

I have the same problem, after Installing SQL 2005 SP1 on Clustermachines.

However my SQL-Cluster has a problem moving groups, which I hold responsible for failing to install the SP1 on the Database Engines.

I have 32 Bit Machines.

I find interesting though that my BTS 2006 Machines that use the SQL Servers have the same Problem too, even they don't have any SQL Server on it themselves.

Is it feasable to believe that the Problem is maybe in some other Patch we installed that affects the SQL Client Components?

I have also installed the Hotfix NDP20-KB918642-X86_bugfix.exe which is supposed to fix the annoying Shim Database Error Message (you know it?).

Any new suggestions, workarounds, patches?