sql or my sql query


in my database  i have the two tables...

1)programs                                2)reserved

in the programs...two fields 1)program id           2)maxseats................these details wil be entered by admin

in the reserved table  two fileds ..1)PRogramid        2)status

my requirement is .. i need the available seats..means

if any body is intersted in  any program...they wil select the program...then status becomes approved(1)..

then i need the o/p as available seats ..means if any body selects the program...then the maxseats should be decremented by 1...o/p should be the remaing seats..

11/30/2007 6:17:25 AM
asp.net.sql-datasource 29906 articles. 0 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 15
Get it on Google Play
Get it on Apple App Store


To get the number of seats for a program:

SELECT maxseats
FROM programs
WHERE program_id = @ProgramId

And you might be needing a couple of UPDATE queries for the other logic:

UPDATE reserved_table
SET status = 'Approved'
WHERE program_id = @ProgramId

UPDATE programs
SET maxseats = maxseats - 1
WHERE program_id = @ProgramId


Coolest Bananas
11/30/2007 10:02:59 AM

Similar Artilces:

SQL Query , SQL or Procedural
HIHi i need some help on what the SQL query would be, let's say i have a resultant table like this. Group TestID Result A AA 10 A BB 30 A CC 20 B AB 200 B AC 300 A DD 50 C AA 1000 and i need to query by group and re-name every field as its TestID value for that selected group:  Example:if group "A" is selected: AA BB CC DD 10 30 20 50 if group "B" is selected: AB BC 200 300 and so on.. thanks.   Here is a sample for you to play with PIVOT: SELECT [...

Can sql queries be nested in sql queries?
I am having problems with a template that uses the information from one sql query to generate a query on another table. Let me be more specific. The template in question receives a category ID value from a web page that provides a menu of several categories to choose from. Each Category ID represents several Items or products to choose from. When the template receives the category ID, the first thing it does is run a query on my item_category table (this table lists all of the items and associates them with the appropriate category). This query returns several itemIDs that are all...

I have a problem, my asp.net page wants to connect to the sql server, but it has to be the mysql. How can I solve this problem? This is my code: <%@ page explicit="true" language="VB" debug="true" %> <%@ Import Namespace="System.Data" %> <%@ Import Namespace="System.Data.Odbc" %> <%@ Import Namespace="System.Data.SqlClient" %> <html> <script runat="server"> sub page_load(sender as object, e as eventargs) If Not IsPostBack Then dim connect as sqlconnectio...

SQL A and SQL Server
Hi I heard SQL Server used to be owned by Watcom is this true? Is SQL Anywhere, therefore, similar to SQL Server? -- Regards, John Not quite true. SQL Anywhere was created by Watcom. SQLServer was created by Sybase, and Microsoft licensed the technology. So MSSQL and ASE have common roots, not SQLAnywhere. -- Paul Horan[TeamSybase] "John Kingan" <john.kingan@abibuildingdata.com> wrote in message news:40d82aa1$1@forums-1-dub... > Hi I heard SQL Server used to be owned by Watcom is this true? Is SQL > Anywhere, therefore, similar to SQL Ser...

SQL Express to SQL ?
I am developing a site using the express edition of all tools (VWD and SQL Express).  I want to use GoDaddy hosting and was wondering if I will be able to effectively put my SQL database and website up on their hosting even though it was developed via Express edition of Microsoft programs?...

Huge SQL Queries in SQL 2005
Good evening:  We're porting an old app written in ASP.NET  1.1433 and SQL 2000 to ASP.NET 2.0 and SQL 2005.  In the old app we have a few data grids that are populated from a dataset pulled from the database.  We use a SQL query that we build based on more than 10 different user inputs, the result of which is an enormously complicated SQL string.  We'd like to move this processing into a SPROC in the 2005 database. Rather than writing stored procedures to create the SQL SELECT statement, is it possible to pass an entire select state ment to a SPROC and hav...

Converting a gridView using an Sql Datasource to a gridview who is not using an SQL DataSource
How can i rewrite this page so that i doesnt make use of an SqlDataSource?  <%@ Control Language="C#" AutoEventWireup="true" CodeFile="LoginHistory.ascx.cs" Inherits="Private_UserControls_WebUserControl" %> <html> <head> <%--<link rel="stylesheet" href="BaldwinPortal.css" mce_href="BaldwinPortal.css" type="text/css" />--%> <title>Login History</title> </head> <body style="margin:0 0 0 0;padding:0 0 0 0"> ...

SQL query that works in SQL Server Management Studio, but doesn't on .NET 2.0 page
SELECT favorites.FID, favorites.filename, favorites.username, files.status, files.private, files.views, files.title FROM favorites INNER JOIN files ON favorites.filename = files.filename WHERE (favorites.username = @username) AND (files.status IS NULL) AND (files.private = @private)@private is manually set to 'no'@username is set to profile.usernamewhen I run the above query in microsoft sql server mgmt studio express on the database, it presents all the information i'm asking for very easily. however when i try to implement this query on a aspx .net2.0 page with teh sqldatasourc...

how to connect sql server using sql query?
Hi all, Please explain how to connect sql server using sql query?. My problem is need to get the data from one server table and insert into another server tables using stored procedure. It is possible by using C# coding. But i need to do using stored procedure. becoz each server have own connection string, username and password.  Please anyone help me? Thanks in advance!!! Hi, You can create a linked server between the two databases and then fire the queries. http://www.sqlservercurry.com/2008/03/how-to-set-up-your-database-for.html   HTH,Suprotim AgarwalA...

Announce: BNF Grammars for SQL-92, SQL-99 and SQL-2003
Hi Folks Jonathan Leffler has sent me these grammars, which I'm hosting at: http://savage.net.au/SQL/ -- Cheers Ron Savage, ron@savage.net.au on 17/07/2005 http://savage.net.au/index.html Let the record show: Microsoft is not an Australian company At 11:08 AM +1000 7/17/05, Ron Savage wrote: >Hi Folks >Jonathan Leffler has sent me these grammars, which I'm hosting at: >http://savage.net.au/SQL/ Thanks for posting that; should be very useful. I will point out an apparent spelling mistake, though. See http://savage.net.au/SQL/sql-2003-noncore-feat...

SQL code to stop and restart sql server 2005 and sql agent
Hi. I would like to restore a SQL Server 2005 database from a backup file. The problem is that the users which are using the site, prevent the restore operation from completing. So, I stop the sql server by right clicking the server name in management studio and selecting stop, wait for 3-4 minutes and restart it by clicking start. Then I can restore. So I am looking for code that can do these operations (including the wait). let me just add that I am using a named instance - and I want to stop and restart the instance. Please help, thanks in advance. I found this link http://...

Sql Query String verses SQL Stored Procedure
I'm working on the performace of my pages. I want to allow large datasets and get the best performance I can. I've read that Stored Proceedures(SP) are faster than passing a Query String(QS). The questions I have are: Given the code of this page, will I see an improvement in performance using a SP? If yes, how do I allow for just SOME of the variables being passed? Users are nor required to enter all parameters. As far as I know, if you create a SP in SQL Server and don't pass ALL of the parameters it expects, you'll get an error. Also, someone mentioned that string concatinati...

How do I on a SQL Querie on Sybase SQL Server12 Eliminate the headers.
How do I eliminate the column heading on SQL querie using Sybase SQL Server 12 ? Is there any Set Header off command? Thanks Edgar "EN" <edgardon@medicalcardsystem.com> wrote in message news:955mB1j4AHA.249@forums.sybase.com... > How do I eliminate the column heading on SQL querie using Sybase SQL Server > 12 ? > Is there any Set Header off command? > > Thanks > Edgar > If you're using ISQL, specify the -b option to suppress the headers HTH, Rob ---------------------------------------------------------------------- Ro...

Posting SQL data to gridview from a long sql query
I just started working with ASP.Net and have been using the Microsoft VWD 2005.  I have a sql query that will run for anywhere from 4 to 5 minutes when run from the query analyzer.  I have run the query through the profiler and can not come up with a method to speed up the query.  The query is creating a list of distinct names from a 24 period and then creating 10 different counts for each name.  If I create sql query in the vb code on the asp page and then have it create a collection to hand over to the gridview I can present the data but it takes 4 to 5 minutes and if t...

Web resources about - sql or my sql query - asp.net.sql-datasource

Query - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Qubole Debuts Presto-As-A-Service, Based On Facebook-Created Open-Source Interactive Query System
Facebook announced last November that it would open-source interactive query system Presto , and now cloud big data platform provider Qubole ...

faroo_p2p: FAROO Search: Spelling correction, Query completion and Instant search http://t.co/TgHECDe5 ...
faroo_p2p: FAROO Search: Spelling correction, Query completion and Instant search http://t.

Query Strings - Quora
Quora is your best source for knowledge.

A Query A Quest A Quotation - Flickr - Photo Sharing!
One of a series of library education posters designed by Peabody Visual Aids in the 1930s and 1940s, which I salvaged from a throw-away pile ...

US to query China on passport maps
The US will raise concerns with China over a new map in Chinese passports which details claims to disputed maritime territory.

Rio Tinto worker sacked after saying 'fk you' to boss over safety query
The Fair Work Commission has answered that burning question: Is it fair to sack someone for saying &quot;*f*ck you&quot; to the boss?

Photos query over student who died in 40m cliff fall
Police are investigating whether a French student who plunged 40 metres off a cliff in the Royal National Park was taking or posing for photographs ...

'Pies query Cloke frees after AFL loss
Collingwood coach Nathan Buckley stresses Travis Cloke's lopsided free-kick count was not the No.1 issue after they lost to Richmond by five ...

Socceroos: Ange Postecoglou gets shirty with Tajik official's 'disrespectful' quit query
Socceroo boss Ange Postecoglou bristled, captain Tim Cahill looked bemused, and the Australian press corps could barely surpress their surprise. ...

Resources last updated: 12/8/2015 3:20:26 AM