SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseSQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old April 24th, 2002, 09:04 AM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,575 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 23
Retrieving one record out of 1000 from tabel

<i><b>Originally posted by : Malte (newbrainstorm@hotmail.com)</b></i><br />I have a table with 1000 seatnumbers. Everytime the website is accessed a new seat should come up (starting with 1 up to 1000) . After the seat came up, it should be deleted from the table. I have used a stored procedure and I call it in ASP.<br />How should the SELECT statement look like in the stored proc.?<br />I have now this, which will show all 1000 seats at once:<br />Stored procedure:<br /><br />SELECT [02seatno_mad1000].i1_seatno<br />FROM 02seatno_mad1000;<br /><br />The ASP:<br /><br /><% <br /> ' Connection String<br /> ' Provide relative path to your StoredProc.mdb<br /> ' database<br /> Dim reservat_date <br /> Dim i1_seatno <br /> <br /> reservat_date = Date()<br /> <br /> ' Connection String<br /> ' Provide relative path to your StoredProc.mdb<br /> ' database<br /><br /> Dim connStr<br /> connStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("Netwings_db1.mdb")<br /><br /> ' Connection Object<br /> Dim con<br /> Set con = Server.CreateObject("ADODB.Connection")<br /> <br /> Dim rs<br /> ' connecting to database<br /> con.Open connStr<br /><br /> ' executing stored procedure<br /> Set rs = con.Execute ("exec call_seat_mad 'i1_seatno'")<br /> ' showing all records<br /> While Not rs.EOF<br /> Response.Write rs(0) & " " <br /> rs.MoveNext<br /> Wend<br /><br /> ' closing connection and freeing resources<br /> con.Close<br /><br /> Set rs = Nothing<br /><br /> Set con = Nothing<br /> %><br /><br />

Reply With Quote
  #2  
Old November 14th, 2003, 06:32 AM
lvramani lvramani is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 14 lvramani User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Logic for Stored Procedure

Dear Steve,
If you are comfortable writing Stored Procedures, you can start like the following:-

Inside the Stored Procedure you must have queries like

@p_empno as Integer=NULL


If @p_empno IsNull
Begin
Select top 1 * from EMP
End

If @p_empno Is Not Null
Begin
Delete from EMP where empno = @p_empno
End
--Stored procedure ends. I have only give the logic of the sp. So do not blindly copy paste the above in the SP Editor

Very important--Once the particular record is displayed in the ASP, you must be have the say EMPNO. There must be an event like form submit or form click where by you need to send the empno as the parameter to the same stored procedure so that the particular record is deleted.

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseSQL Development > Retrieving one record out of 1000 from tabel


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT