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.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2001-10-15 : 17:13:05
|
| veerag writes "hi, thanks for answering my first question. here i am having one more problem.first of all in my GLOBAL.ASA i declare like this. <SCRIPT LANGUAGE=VBScript RUNAT=Server>Sub Session_Onstart session("idshopper") = 0 ( SeT THE SHOPPER ID AT 0 whenever new session starts)End Sub after that in my home page(i.e) header.aspif session("idshopper") = "0" then (check to see if shopperID=0) if Request.Cookies("NS") = " " then (NS is my cookie name) set dbshopper = server.createobject("adodb.connection")(ADO DATABASE CONNECTION) set rsshopper = server.createobject("adodb.recordset") (CREATING RECORDSET) dbshopper.open "provider=SQLOLEDB.1;uid=sa;pwd=sa;server=sagar;database=master" (CONNECTION USING SYSTEM DSN) sql="execute sproc_insertshopper" (CALL THE STORED PROCEDURE) set rsshopper =dbshopper.Execute(sql) (EXECUTING THE SQL STATEMENT) session("idshopper") = rsshopper("idshopper") (SET THE ID IN SESSION VARIABLE) end ifend if my problem is,i can't able to call and execute the sql stmt.i can't retrieve the shopper id.MY SHOPPER TABLE -----------------CREATE TABLE dbo.shopper(idshopper int IDENTITY(1,1) NOT NULL,chrfirstname varchar(50) NULL,chrlastname varchar(50) NULL,chraddress varchar(150) NULL,chrcity varchar(100) NULL,chrstate varchar(25) NULL,chrzipcode varchar(20) NULL,chrphone varchar(30) NULL,chremail varchar(150) NULL,chrusername varchar(25) NULL,chrpassword varchar(25) NULL,intcookie tinyint NULL CONSTRAINT DF_SHOPPER_intcookie_1_12 DEFAULT(0),chrcountry varchar(150) NULL,CONSTRAINT PK_8_12 PRIMARY KEY CLUSTERED (idshopper) )MY STORED PROCEDURE-------------------/* insert a new shopper into database */CREATE PROCEDURE sproc_insertshopper AS/* insert shopper into database and set first and last name blank*/insert into shopper(chrusername,chrpassword) values (' ',' ') select idshopper = @@identity ( return identity column id of the shopper )GOin this shopper table,idshopper is the IDENTITY variable and primary key(int).if i execute the procedure,the system will generate the number. with that number only,ican use parameters for other procedures. if i execute the procedure in sql,it is generating the number.but i don't want that no.i want to generate no. from the front end. my stored procedures and sql statements are storedin the "master" database.1.i can create cookies here itself. 2. i cann't assign values of idshopper(i.e. it is created in sql server) in my session("idshopper") ADODB.Fields error '800a0cc1' ADO could not find the object in the collection corresponding to the name or ordinal reference requested by the application. /ANAND/header.ASP, line 18 i hope so u will clear my doubts.byeveerag" |
|
|
|
|
|
|
|