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)
 How to run my Microsoft SQL 7 queries by clicking on a button in a web page

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-08-11 : 07:07:58
Todd writes "Hello,

I am new here and new to Database development for the web. I have a need to create a web page which will contain buttons which will have the ability to run queries (which i've already written) and the results appear in a window (new web page).

The following is an example of one query I would like to launch from a button in a web page:

/* FIND TRADE / CASH ERRORS IN THE VISMA DATABASE
AUTHOR TPicquelle
USAGE: Click on run, there is nothing to set by the user.

History
23Jan2003 TPicquelle Added (NOLOCK)
27Sep2002 TPicquelle Correct cast of x-ref
19Sep2002 TPicquelle Initial design
*/
use f0001
--FIND the parent of the TRADE revenue types (assume that type 13 is always trade)
declare @tradeParent int
select @tradePArent = inf from r2 (NOLOCK) where rno = 13

select ct.vodt as "Transaction",valdt as 'Posted',
convert (varchar(10),sta.Nm) as Station,
convert (varchar(15),ae.Nm) as AccountExec,
convert (varchar(22),adv.Nm) + '/' + convert (varchar(22),adv.Nm) as "Advertiser/Agency",
--adv.empno as Advertiser#,
--convert (varchar(22),adv.Nm) as Advertiser,
--agc.empNo as Agency#,
--convert(varchar(22),agc.nm) as "Agency/Advertiser",
ct.votp as VoucherType,
str(ct.r2,4,0) as Rev,
str(ct.am,10,2) as Amount,
str(ct.ram,10,2) as Outstanding,
ct.invono as "Invoice#",
ct.ordno as "Order#",
ct.agref as "X-ref",
str(ct.qty,10,2) as "Agc Com",
str(ct.Intrt,20,2) as "AE com",
ct.txt as text
from
CustTr ct (NOLOCK)
left outer join R3 sta (NOLOCK) on sta.RNo = ct.R3
left outer join R1 ae (NOLOCK) on ae.RNo = ct.R1
left outer join R1 rt (NOLOCK) on rt.RNo = ct.R2
left outer join actor adv (NOLOCK) on adv.EmpNo = ct.EmpNo
left outer join actor agc (NOLOCK) on agc.EmpNo = ct.CustNo
where
--( --check all credit voucher types (2,3,4,5,40)
-- ct.VoTp in ( select vt.VoTpNo from votp vt where vt.crac = 0 and afftrn = 0)
--OR ct.VoTp = 1 -- need invoices too!
--) AND
-- ignore adjustments and trade specific voucher types
ct.votp not in (33,34,23,24,25,26,27,28)
AND
--look for trade revenue types (13,14,15,16,17,18,48)
ct.r2 in (select rno from r2 where inf = @tradeParent)
AND
-- if remaining is not the same as amount - it was matched!
CT.am <> CT.RAM
-- ignore misc revenue types
--and (ct.r2 < 1000)
order by valdt desc, adv.Nm asc, ct.CustNo asc, ct.Txt2 asc

--select * from EmpV
--select * from actor
--select * from votp vt where vt.crac = 0 and afftrn = 0
--select rno, inf, nm from r2 order by rno
/*
--Birmingham Revenue types used - need to catch user child trade types!!!
select distinct rt.rno, rt.nm, rt.inf, rt.inf2 from custtr ct
left outer join R2 rt on rt.RNo = ct.R2
order by rt.rno
rno nm inf inf2
----------- ---------------------------------------- ---------------------------------------- ----------------------------------------
7 Local Agency 1 7
8 Local Direct 1 8
10 Natl Political 2 10
11 Natl Rev 2 11
12 Network Revenue 3 12
13 Trade Rev 4 13
19 Loc Ag Pol 1 19
33 Local Non Trad 1

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2003-08-11 : 07:49:45
Read a good beginning book about ASP or ASP.NET.

I personally learned from SAMS "Teach yourself ASP in 21 Days". It took me 22 days, though, so never judge a book by it's cover.

- Jeff
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2003-08-11 : 08:01:20
ROFLMAO!

I'm still working on my Beginning ASP.Net in C# book after having it for over a year.
Go to Top of Page
   

- Advertisement -