Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Is there an full-blown example of ASP/MSSQL using Northwind?

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-03-02 : 07:31:44
Dan Thurman writes "Hello,

I apologize as you have stated: NO ASP questions
but I am unable to find any other resource to my
specific questions involving BOTH ASP and MSSQL
development... I hope you will consider... if
you can, perhaps you can direct me to links or places
where I can find such an answer?

I am trying to learn how to implement ASP/MSSQL code
using db tables with referential checks. For example,
does it make sense to use SQL statements in ASP code
to update tables where records of one table must be filled
before another table can be updated due to reference checks.

The question is, can this be done strictly with SQL in ASP
code or does it require stored procedures? One problem I
have yet to understand is, how is a FK obtained after an insert
into a table obtain in order to use it to update another table requiring it for referential checks to be satisfied using
only SQL and ASP (and not stored procedure) code?

Is there a full-blown example with ASP and Northwind (MSSQL, not Access) available that explains my question by example?

Thanks!

Dan"

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2004-03-02 : 09:04:51
The question is, can this be done strictly with SQL in ASP
code or does it require stored procedures?

A. You should use stored procedures for everything. Never write directly to a database from inline code. This is a security and maintenance best practice.

One problem I have yet to understand is, how is a FK obtained after an insert into a table obtain in order to use it to update another table requiring it for referential checks to be satisfied using
only SQL and ASP (and not stored procedure) code?

A.

DECLARE @identity_field INT

INSERT table(col1,col2) values(1,2)

SELECT @identity_field = SCOPE_IDENTITY()

Doing this will give you the identity you just inserted.

Is there a full-blown example with ASP and Northwind (MSSQL, not Access) available that explains my question by example?

A. I'm not aware of any examples using Northwind. I believe ASP.NET has some good examples of code and stored procedure/database integration with their starter kits.

The best thing to do is get a good SQL Server book and a good SQL Server development book. Learn how things are really working, just like you would do to learn ASP.NET. Karen Delaney has some really good books. There is a list of resources here also: http://www.sqlteam.com/store.asp



MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page
   

- Advertisement -