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

Wednesday, March 28, 2012

Moving a logic loop to SQL Server

I am using C# and ASP.NET 2.0, with SQL Server 2000. In my database I have a table that is similar to the following:

WebpageId WebpageAddress Handler
1 /company/about ~/about.aspx
2 /blog ~/blog.aspx

As you can guess, one of my queries will be a SELECT command where WebpageAddress = @.address.

The hiccup I have is with a friendly URL such as the following:

/blog/2005/10/6

The friendly URLs have no extension, so I cannot immediately "pick out" the extension. (If the address were /blog.aspx/2005/10/6, then things would be simpler.)

What I am doing at present is using a loop in C# where I first perform a query with that full address. If no match is found, I trim the address back to the last slash (/blog/2005/10) and perform another query. If no match is found, I trim the address (/blog/2005) and perform another query. Again, no match is found, so I trim the address again (/blog) and perform yet another query. This time, a match is found, in which case the URL rewriting looks vaguely like this:

~/blog.aspx?parameters=2005/10/6

While this works fine, these friendly URLs require hitting the database up to four or five times. My question is, can this looping logic be moved to SQL Server?

My SQL knowledge is extremely basic, so I am just looking for someone to point me in the right direction. If it is not possible, I'd love to know now rather than wasting hours trying. If it is possible, I've love to know the keyword or technique involved, so that I can Google for the full answer.

SELECT TOP 1 Handler
FROM MyTable
WHERE WebpageAddress=SUBSTRING(@.address,1,LEN(WebpageAddress))
ORDER BY LEN(WebpageAddress) DESC

I think will give you what you want. However, to answer your question, yes, you can loop as well, but it'd be slower.

Friday, March 23, 2012

Moving : AccessSQL Server 2005(Enterprise Edition) VB6—VB.Net

I am a new in .Net Environment. I am moving from VB to VB.Net and Access DB to SQL Server 2005. Please reply me the following questions bellow.

Access Works

SQL SERVER (SS)?

When I create .MSI file it include ADO library in that executable file and my client install software and don’t need any kind of file to install and wherever my program install it can be accessed by using following connection string.

Con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db\PAYROLL_DB.mdb;Persist Security Info=False" Con.Open

What file needed on client’s PC to access SS on server.

What about connection string change dynamically in client sides

I create relation on Access Relationship Diagram.

Where to create these diagrams either on VB.Net Server Explorer or on Management Studio? And how?

Please answers me this basic questions further I have more question in mind but please first answers me these questions…

Hi,

What file needed on client’s PC to access SS on server.

What about connection string change dynamically in client sides

-You will just need a driver to access SQL Server like the ADO (included in MDAC) or ADO.NET (included in the .NET FW) or the SQL Server Native Client (SNAC).

Where to create these diagrams either on VB.Net Server Explorer or on Management Studio? And how?


I would create them in the SSMS, don′t know if the functionality is EXACTLY the same as in server explorer, but I am used to to it there, but from a short inspection of mine I would say that they are feature-identical.

Jens K. Suessmeyer.

http://www.sqlserver2005.de

Moved asp.net app to network share, cant access SQL

I've recently moved an asp.net website from my PC to a network share because another tech it going to be working on it. I finally got the correct permissions on the network share and the correct .NET Framework settings on my PC to be able to run the app. Now I can't access the SQL server which is on a different server. Getting the following error:

Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

How to I setup access to my SQL server for the app from any given PC on my LAN?

Your current error is not SQL Server permissions but CAS(code access security) you have to fix that before, you can get the error related to SQL Server permissions if any. The two links below covers the issues related to your error. Hope this helps.

http://forums.asp.net/thread/1522588.aspx

http://blogs.msdn.com/shawnfa/archive/2003/06/20/57023.aspx

Monday, February 20, 2012

MS Reporting Services and Passing Credentials from .NET App

Expert Needed,
Is it possible to pass credentials from a .NET application into MS reporting
services?
For example we want to filter our data for our reports based on the user's
login into the .NET app.
Thank you in advance.
RichI am trying to do the very same thing from a .Net windows application and if
get it will post my results.
Dan
"Rich" <rwatson@.brick.net> wrote in message
news:eNq3unf9FHA.3664@.TK2MSFTNGP10.phx.gbl...
> Expert Needed,
> Is it possible to pass credentials from a .NET application into MS
> reporting
> services?
> For example we want to filter our data for our reports based on the user's
> login into the .NET app.
> Thank you in advance.
> Rich
>|||The recommended approach will be the use RS custom security if you need to
pass the user credentials. Alternatively, once the application
authenticates, it can use a single "trusted" Wi ndows account to connect and
authenticates against RS.
--
HTH,
---
Teo Lachev, MVP, MCSD, MCT
"Microsoft Reporting Services in Action"
"Applied Microsoft Analysis Services 2005"
Home page and blog: http://www.prologika.com/
---
"Rich" <rwatson@.brick.net> wrote in message
news:eNq3unf9FHA.3664@.TK2MSFTNGP10.phx.gbl...
> Expert Needed,
> Is it possible to pass credentials from a .NET application into MS
> reporting
> services?
> For example we want to filter our data for our reports based on the user's
> login into the .NET app.
> Thank you in advance.
> Rich
>|||Is possible to pass credentials, you need to include in your .NET
application a reference to Web Services that is installed on Server that had
Reporting Services. Then, you can use all the method that this web services
expose, as
ReportingService rs = new ReportingService();
System.Net.NetworkCredential cr = new System.Net.NetworkCredential(UserName,
Password, Domain);
rs.Credentials = cr;
I hope that this help you.
"Rich" <rwatson@.brick.net> wrote in message
news:eNq3unf9FHA.3664@.TK2MSFTNGP10.phx.gbl...
> Expert Needed,
> Is it possible to pass credentials from a .NET application into MS
reporting
> services?
> For example we want to filter our data for our reports based on the user's
> login into the .NET app.
> Thank you in advance.
> Rich
>

MS Reporting Services 2000 Error ?

hi

when i try to use Reporting Services to render a report from aspx page

(web app) (vb.net) by usingReportingServices.dll (by add referennces)

i am not using (web referennces)

i get this erorr :

==================

System.Web.Services.Protocols.SoapException: The permissions granted to user 'NT AUTHORITY\NETWORK SERVICE' are insufficient for performing this operation. > Microsoft.ReportingServices.Diagnostics.Utilities.RSException .

note:

=====

- i have windows 2003 server ent.

- sql 2000 sp3 .

- MS Reporting Services 2000 sp2 .

- i am login as administrator .

pls tell me what i can do ?

thank you all

Hi,

as you did not post any code, I can give you a common suggestion. If you use impersonation, you will have to use the credentials of the actual user and add it to the instantiated proxy of the webservice. This will make the call to the webservice under the credentials and the permissions of the impersonated user.

HTH, Jens K. Suessmeyer.


http://www.sqlserver2005.de

|||Correct me if I'm wrong, but if you don't do this then it uses the identity of the app pool under which the website runs which by default is network service for the default app pool|||yep.

Move databas from express to sql 2000

Hi!

I have created i webpage whos has a logged in system which is cretead in VS 2005 with the function ASP.NET configuration.

And know will i move all databas to i a MSSQL 2000 there i only can have one databas, And know i have ASP.NET logged in Databas and one site databas.

I just wondering if its possible to make i virtual connection with MSSQL 2000? If not somebody has some idés for me?

I hope you can understand me.

If I understand, right now on your development environment you have the ASPNETDB database (logged in system) and also a site database. And you need to move to SQL Server 2000 where you'll only have one database.

You can combine the security schema (aspnetdb) and the site schema into the same SQL 2000 database - this should not be a problem. To install the ASP.Net security schema into an existing SQL 2000 database, you can run aspnet_regsql.exe against the database. So if the site database is already on this SQL 2000, just run aspnet_regsql against the same database (or get the DBA to do so) and then you'll need to point your database connection (in the web.config) against the SQL Server.

|||

Ok, tanks!

But i don't know how i do that. can you explain? If you want step by step.

The sql server and the webserver is on a webhotel, so i can't do any configuration.

|||

someone who can explain for me?

Now i just have to move the login database (ASTNETDB) into another database (a SQL 2000 database)

Someone?

|||

So now i know how i have to do. But when i use the aspnet_regsql.exe so i get a error.

Error

Grantor does not have GRANT permission.

The error comes when installCommon.sql