hii i have three tables naming Cards_issue,Cards_return and Cards_Sold.
have to perform some working as while inserting data in Cards_return table it should check that the data inserted is not less than Cards_issued and it should update Cards_Sold table by Cards_issue-Cards_return.....
plz help me in this context...

Recommended Answers

All 6 Replies

What code have you got so far? Have you tried using google and other search engines to prowl the endless resources available to you on such topics? (Which is 99% a no, as I can think of a site off the top of my head covering all of database working)

yes i have tried as i am new to coding i am not getting it properly

Have you tried looking at the DB stuff on here?

i have used this procedure...


create procedure cards @salesman varchar(10), @RCV10 int,@RCV09 int,@RCV15 int,@GPRS15 int,@RCV20 int,@RCV25FTT int,@RCV25 int,@RCV31 int,@RCV30 int,@RCV35 int,@RCV50 int,@RCV55 int,@SIM int,@VTOPSIM int,@VTOPBAL int,@THREEGSIM int, @entrydate datetime
AS
BEGIN
if exists(select * from CardsIssued where salesman=@salesman and RCV10>@RCV10 AND RCV09>@RCV09 AND RCV15>@RCV15 AND GPRS15>@GPRS15 AND RCV20>@RCV20 AND RCV25FTT>@RCV25FTT AND RCV25>@RCV25 AND RCV31>@RCV31 AND RCV30>@RCV30 AND RCV35>@RCV35 AND RCV50>@RCV50 AND RCV55>@RCV55 AND SIM>@SIM AND VtopSim>@VTOPSIM AND VtopBal>@VTOPBAL AND ThreeGSim>@THREEGSIM and EntryDate=@entrydate )
BEGIN
insert Cards_Returned values(@salesman,@RCV10,@RCV09,@RCV15,@GPRS15,@RCV20,@RCV25FTT,@RCV25,@RCV31,@RCV30,@RCV35,@RCV50,@RCV55,@SIM,@VTOPSIM,@VTOPBAL,@THREEGSIM,@EntryDate)
END
ELSE
PRINT'CARDS RETURNED CANNOT BE GREATER THAN CARDS ISSUED'
END
execute cards 'S001',50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,'28/1/2013'

the error is...
Msg 8114, Level 16, State 5, Procedure cards, Line 0
Error converting data type varchar to datetime.

plz let me know the exact changes

My guess on interpreting the error is that you are sending a varchar type where it expects a datetime, I don't have the most experience with actual SQL procedures though so hopefully someone with more experience can pick up here with the issue

can u plz let me know how to code it with c#

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.