Showing posts with label website. Show all posts
Showing posts with label website. Show all posts

Tuesday, March 20, 2012

Can not access SQL database for Website security settings

I'm using Visual Studio 2005 (8.0.50727.42) and going into the menu option Website > ASP.Net Configuration, access the security tab and all I get is an error message stating that there is a problem with the selected data store "Unable to Connect to the SQL Server Database"

I have SQL Server 2005 (Express Edition). I have created a database "NetDev" with the right connection, etc.

I can use the SQL server fine for my Windows applications, but somehow this ASp.Net Configuration tool is not making any sense.

I also used the aspnet_regsql command from framework 2.0 to create a DataBase to no avail.

Does anyone out there knows if there is a bug with this tool?

Responding to my own question.

I finally reinstalled everything from scratch, IIS first, and then Visual Studio and my problem went away. It obviously had some corruption as I havce deleted and recreated many apps I may have induced some problems. Also the NET Service had to be added to the APP-Data dir with write permissions (this may have been the real cause).

sql

Thursday, March 8, 2012

Can I use varible here in Stored Procedure?

Hi.
There are two webpages in my website. one displays 10 articles last updated
and another one displays 6 articles last updated. So I want to use only one
procedure to do this, and wrote the following code:
CREATE PROCEDURE [dbo].[articleLastUpdated]
(
@.nNumber smallint
)
AS
SELECT TOP @.nNumber Title, Link From MYARTICLES Order By DATEADDED Desc;
GO
Unfortunately, SQL always prompt me a Syntax error. Is there any way to do
it? Or I must to write two procedures? thanks!Hi,
If you are using SQL 2005 you can do this...
declare @.rows int
set @.rows = 10
select top (@.rows) * from sys.objects
Remember you need the brackets round @.rows!
If not, you can use set rowcount...
SET ROWCOUNT @.nNumber
SELECT Title, Link ... ORDER ..
Tony Rogerson
SQL Server MVP
http://sqlserverfaq.com - free video tutorials
"mizi" <haha@.haha.com> wrote in message
news:Xns9718D21D69A72hahahahacom@.207.46.248.16...
> Hi.
> There are two webpages in my website. one displays 10 articles last
> updated
> and another one displays 6 articles last updated. So I want to use only
> one
> procedure to do this, and wrote the following code:
> CREATE PROCEDURE [dbo].[articleLastUpdated]
> (
> @.nNumber smallint
> )
> AS
> SELECT TOP @.nNumber Title, Link From MYARTICLES Order By DATEADDED Desc;
> GO
> Unfortunately, SQL always prompt me a Syntax error. Is there any way to do
> it? Or I must to write two procedures? thanks!|||"Tony Rogerson" <tonyrogerson@.sqlserverfaq.com> wrote in
news:O8eKNjT8FHA.3760@.TK2MSFTNGP14.phx.gbl:

> Hi,
> If you are using SQL 2005 you can do this...
> declare @.rows int
> set @.rows = 10
> select top (@.rows) * from sys.objects
>
> Remember you need the brackets round @.rows!
> If not, you can use set rowcount...
> SET ROWCOUNT @.nNumber
> SELECT Title, Link ... ORDER ..
>
Is there any difference between use 'select top' and 'set rowcount'? for
example, the efficiency?|||you could do this
CREATE PROCEDURE [dbo].[articleLastUpdated]
(
@.nNumber smallint
)
AS
exec('SELECT TOP ' + @.nNumber + ' Title, Link From MYARTICLES Order By
DATEADDED Desc;')
GO
regards
Michel Posseth [MCP]
"mizi" <haha@.haha.com> wrote in message
news:Xns9718D21D69A72hahahahacom@.207.46.248.16...
> Hi.
> There are two webpages in my website. one displays 10 articles last
> updated
> and another one displays 6 articles last updated. So I want to use only
> one
> procedure to do this, and wrote the following code:
> CREATE PROCEDURE [dbo].[articleLastUpdated]
> (
> @.nNumber smallint
> )
> AS
> SELECT TOP @.nNumber Title, Link From MYARTICLES Order By DATEADDED Desc;
> GO
> Unfortunately, SQL always prompt me a Syntax error. Is there any way to do
> it? Or I must to write two procedures? thanks!|||Yes there is, also depends what you are doing and whats indexed before you
notice.
Doing a test on a table with 730,000 rows in it i ran the following SQL and
the plans where very similar except the sort step on the TOP had 10 rows,
the ROWCOUNT had the whole table, the IO statistics are as follows:-
With TOP...
Table 'mb_message'. Scan count 1, logical reads 11889, physical reads 7,
read-ahead reads 11694.
(10 row(s) affected)
Table 'mb_message'. Scan count 1, logical reads 11889, physical reads 4,
read-ahead reads 1978.
(10 row(s) affected)
Basically they are the same, the read-ahead are different because a lot of
the data would have been in the cache from the previous read.
Personally, if you are using 2000 i'd use SET ROWCOUNT simply because you
don't have to use dynamic SQL which would mean you have to permission the
base tables to the user instead of just execute on the stored procedure,
other than that - use 2005 :)
Tony.
Tony Rogerson
SQL Server MVP
http://sqlserverfaq.com - free video tutorials
"mizi" <haha@.haha.com> wrote in message
news:Xns9718D507C333hahahahacom@.207.46.248.16...
> "Tony Rogerson" <tonyrogerson@.sqlserverfaq.com> wrote in
> news:O8eKNjT8FHA.3760@.TK2MSFTNGP14.phx.gbl:
>
> Is there any difference between use 'select top' and 'set rowcount'? for
> example, the efficiency?|||mizi <haha@.haha.com> wrote in
news:Xns9718D21D69A72hahahahacom@.207.46.248.16:

> There are two webpages in my website. one displays 10 articles last
> updated and another one displays 6 articles last updated. So I want to
> use only one procedure to do this, and wrote the following code:
> CREATE PROCEDURE [dbo].[articleLastUpdated]
> (
> @.nNumber smallint
> )
> AS
> SELECT TOP @.nNumber Title, Link From MYARTICLES Order By DATEADDED
> Desc; GO
> Unfortunately, SQL always prompt me a Syntax error. Is there any way
> to do it? Or I must to write two procedures? thanks!
select top (@.variable) was introduced in sql server 2005. Note the
parentheses. For SQL server 2000 and before you have to use:
set rowcount @.variable
select title, link...
set rowcount 0
Ole Kristian Bangs
MCT, MCDBA, MCDST, MCSE:Security, MCSE:Messaging

Can I use the 'IF' clause in a 'WHERE' clause ?

Background:
I am developing a website using MS Visual Studio 2005 and SQL 2005 Express.
I'm using SQL queries (not stored procedures yet).
Problem:
I have a query that I can't make work. I found the COALESCE function and it
solves part of the problem but not all.
I have a variable '@.filter_by_date' which is bound to a dropdownlist on the
webpage. The dropdownlist's values are NULL, -7, -14, -30 which represent th
e
number of days to subtract from today's date.
If a user selects the NULL option the query should return all rows which is
how my query is:
SELECT * FROM t_jobs WHERE (created_date >= COALESCE(@.filter_by_date,
created_date))
The problem arises when the user selects any of the other options. If the
user selects -7, for example, then this value should be subtracted from the
current date and used in the query to only show jobs created after that date
.
The query looks like this:
SELECT * FROM t_jobs WHERE (created_date >= GETDATE() -@.filter_by_date)
Is it possible to merge the two queries? I thought of trying to use an 'IF'
in the 'WHERE' clause but I can't get it to work.
Thank you for your time. Hope you can help.You'll probably get better performance with two separate queries, each in
its own stored proc. However, you can try:
SELECT
*
FROM
t_jobs
WHERE
@.filter_by_date IS NULL
OR (@.filter_by_date IS NOT NULL
AND created_date >= GETDATE() -@.filter_by_date))
(assumes @.filter_by_date is a positive number.)
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinpub.com
"Matthew Hill" <MatthewHill@.discussions.microsoft.com> wrote in message
news:6AA25C85-C8B9-48FB-8AE6-8850E0A03161@.microsoft.com...
> Background:
> I am developing a website using MS Visual Studio 2005 and SQL 2005
> Express.
> I'm using SQL queries (not stored procedures yet).
> Problem:
> I have a query that I can't make work. I found the COALESCE function and
> it
> solves part of the problem but not all.
> I have a variable '@.filter_by_date' which is bound to a dropdownlist on
> the
> webpage. The dropdownlist's values are NULL, -7, -14, -30 which represent
> the
> number of days to subtract from today's date.
> If a user selects the NULL option the query should return all rows which
> is
> how my query is:
> SELECT * FROM t_jobs WHERE (created_date >= COALESCE(@.filter_by_date,
> created_date))
> The problem arises when the user selects any of the other options. If the
> user selects -7, for example, then this value should be subtracted from
> the
> current date and used in the query to only show jobs created after that
> date.
> The query looks like this:
> SELECT * FROM t_jobs WHERE (created_date >= GETDATE() -@.filter_by_date)
> Is it possible to merge the two queries? I thought of trying to use an
> 'IF'
> in the 'WHERE' clause but I can't get it to work.
> Thank you for your time. Hope you can help.
>|||Thanks for the help. I implemented your querry into mine but when I go out o
f
and back into the Query Builder the query has changed. My other comparisons
in the WHERE clause have been duplicated for each side of the OR operator. I
s
this normal?
"Tom Moreau" wrote:

> You'll probably get better performance with two separate queries, each in
> its own stored proc. However, you can try:
> SELECT
> *
> FROM
> t_jobs
> WHERE
> @.filter_by_date IS NULL
> OR (@.filter_by_date IS NOT NULL
> AND created_date >= GETDATE() -@.filter_by_date))
> (assumes @.filter_by_date is a positive number.)
>
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Columnist, SQL Server Professional
> Toronto, ON Canada
> www.pinpub.com
> "Matthew Hill" <MatthewHill@.discussions.microsoft.com> wrote in message
> news:6AA25C85-C8B9-48FB-8AE6-8850E0A03161@.microsoft.com...
>
>|||Don't use the query builder. Use Query Analyzer (QA).
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada tom@.cips.ca
www.pinpub.com
"Matthew Hill" <MatthewHill@.discussions.microsoft.com> wrote in message
news:A944E1F3-C855-441C-8F90-F4ED600E33F1@.microsoft.com...
> Thanks for the help. I implemented your querry into mine but when I go out
> of
> and back into the Query Builder the query has changed. My other
> comparisons
> in the WHERE clause have been duplicated for each side of the OR operator.
> Is
> this normal?
> "Tom Moreau" wrote:
>|||Thank you for your prompt replies, much appreciated.
Ok, stupid question but here goes. Is QA in SQL Server? I'm not using SQL
Server yet, waiting until my Visual Studio 2005 Pro turns up (any day now)
before I dable into yet another app.
Mat
"Tom Moreau" wrote:

> Don't use the query builder. Use Query Analyzer (QA).
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Columnist, SQL Server Professional
> Toronto, ON Canada tom@.cips.ca
> www.pinpub.com
> "Matthew Hill" <MatthewHill@.discussions.microsoft.com> wrote in message
> news:A944E1F3-C855-441C-8F90-F4ED600E33F1@.microsoft.com...
>
>|||If you have SQL Server 2000, that's part of the tools that ship with it. If
you have SQL Server 2005, then you use SQL Server Management Studio (SSMS),
that ships with SQL Server 2005.
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinpub.com
.
"Matthew Hill" <MatthewHill@.discussions.microsoft.com> wrote in message
news:476B52A3-1188-46DE-AF3F-B905475B1A1D@.microsoft.com...
Thank you for your prompt replies, much appreciated.
Ok, stupid question but here goes. Is QA in SQL Server? I'm not using SQL
Server yet, waiting until my Visual Studio 2005 Pro turns up (any day now)
before I dable into yet another app.
Mat
"Tom Moreau" wrote:

> Don't use the query builder. Use Query Analyzer (QA).
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Columnist, SQL Server Professional
> Toronto, ON Canada tom@.cips.ca
> www.pinpub.com
> "Matthew Hill" <MatthewHill@.discussions.microsoft.com> wrote in message
> news:A944E1F3-C855-441C-8F90-F4ED600E33F1@.microsoft.com...
>
>

Wednesday, March 7, 2012

can i use SQL server 2005 standard to create and host db for website?

Hi guys,

I am just wondering what's the difference of sql server 2005 standard and enterprise editions. can I use SQL server 2005 to host a database for a website?

Thanks!

Daren

You can find an overview of the features on the Microsoft website (here).
Hosting a database for a website on a Standard Edition is perfectly possible. Enterprise Edition is for really large environments, so if you are expecting millions of hits per day it might be better to use EE because of it's extra features for high level/load databases. But a lot of databases will run just fine on Standard Edition.
|||thanks for the feedback!

Can I use SQL Server 2005 Express in a commercial website?

Does anyone know if it is legal to use SQL Server 2005 Express in a commercial website? There is no need for SQL Server 2005 so the Express would do the job great.

Thx,
Viktor

Yes you can. I do.|||

Yes, you can use it for comercial purpose and also you can distribute it with your application.

Check out this link:

http://www.microsoft.com/sql/editions/express/redistregister.mspx

Good luck.

Can I use SQL Express for a large website?

I run a tutorial website with average 50,000 page views per day and hoping to
grow this number to 100,000 per day in next 1 year. Currently, I use MS
Access database and lot of caching in the web site for performance reasons.
Can I use SQL 2005 Express for such a good traffic web site? Does SQL 2005
express support that much hits? I can continue to use lot of caching to avoid
too many hits to database.
Sounds like a good fit., but it is difficult to talk about specific numbers
or metrics. Sql Express should outperform anything you are able to do with
Access. Sql Express will only utilize a single processor and 1gb of ram.
Databases are limited to 4gb in size.
-A
"ToJo" <ToJo@.discussions.microsoft.com> wrote in message
news:C32CCA39-1E40-4862-AE8C-57833F50459F@.microsoft.com...
> I run a tutorial website with average 50,000 page views per day and hoping
to
> grow this number to 100,000 per day in next 1 year. Currently, I use MS
> Access database and lot of caching in the web site for performance
reasons.
> Can I use SQL 2005 Express for such a good traffic web site? Does SQL 2005
> express support that much hits? I can continue to use lot of caching to
avoid
> too many hits to database.