|
helo all...,
i have create procedure can decrease totalcost from order table(database:games.dbo) with balance in bill table(database:bank.dbo). my 2 database in same server is name "boy"
i have 2 database like: bank.dbo and games.dbo
in games.dbo, have a table name is order(user_id,no_order,date,totalcost)
in bank.dbo, have a table name like is bill(no_bill,balance)
this is a list of bill table
no_bill balance
111222 200$
222444 10$
this is a list of order table
user_id no_order date totalcost
a 1 1/1/07 50$
when customer insert no_bill(111222) in page and click a button, then bill table became
no_bill balance
111222 150$
222444 10$
when customer insert no_bill(222444) in page and click a button, then message "sorry, your balance is not enough"
mystore procedure like:
ALTER PROCEDURE [dbo].[pay]
(
@no_bill AS INT,
@no_order AS int,
@totalcost AS money
)
AS
BEGIN
BEGIN TRANSACTION
DECLARE @balanc AS money
SET @balanc= (SELECT [balance] FROM Bank.dbo.bill WHERE [no_bill] = @no_bill)
UPDATE [bank.dbo.bill]
SET
[balance] = @balanc - @totalcost
WHERE
[no_bill] = @no_bill
COMMIT TRANSACTION
END
it can decrease money in bank, but i want it ceck money if balance > totalcost, so balance-totalcost,
if balance<totalcost,so error="" message"sorry,="" your="" balance="" is="" not="" enough"
when="" i="" execute="" store="" procedure="" pay,="" insert="" no_bill,no_order,totalcost.
i="" want="" if="" totalcost="" that=""> balance, it display message"sorry, your balance is not enough"
is it can make in procedure?
thx...
|
|
|
|
|
Include a IF condition in the procedure that checks whether the Acc.Balance is greater than the TotalCost. If yes Update the Balance and Commit transaction else Raise error and rollback transaction.
Regards J O H N
"Even eagles need a push." David McNally
|
|
|
|
|
thx for ur responding..
my store procedure like that:
ALTER PROCEDURE [bank].[dbo].[pay]
(
@no_bill INT,
@no_order int,
@totalcost money,
@message varchar(100) -- make it output parameter in your stored procedure
)
AS
BEGIN TRANSACTION
DECLARE @balance AS money
select @balance = balance
from bank.dbo.bill
where no_bill = @no_bill
select @totalcost = totalcost
from games.dbo.totalcost
where no_order = @no_order
if (@balance > @totalcost)
begin
set @balance = @balance - @totalcost
UPDATE bank.dbo.bill
SET
[balance] = @balance
WHERE [no_bill] = @no_bill
-- set @message = 'your have enough balance'
end
else
begin
set @message = 'sorry, your balance not enough'
end
COMMIT TRANSACTION
set nocount off
but it's not display message. it's must use output code to display it. but i don't about output code. can u add output code to my store procedure?pls...
thx
|
|
|
|
|
By using DataRelation , we can able to fetch the matched records of two datatables.
How can i get the unmatched records of the two datatables in code behind?
Note : Note in MS-SQL Query.
For example
Datatable 1
----------------
Id
---
100
101
102
103
104
Datatable 2
----------------
Id
----
100
102
My Expecting result is
Id
----
101
103
104
|
|
|
|
|
why dont u use filters
Thanks
Warm Regards
Prakash-B
|
|
|
|
|
Navigate thorugh the DataTable records and Build a resultant DataTable with the records based on the condition.
Regards J O H N
"Even eagles need a push." David McNally
|
|
|
|
|
|
This is ASP.NET discussion board...
Regards J O H N
"Even eagles need a push." David McNally
|
|
|
|
|
Please - no cross posting.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi, I have a html image in one page like this
GetInfo() is javascript function.
How i can get image's Location in javascript function? (Compatible with Firefox)
thanks.
|
|
|
|
|
I found my solution :
function GetInfo(img)
{
SRC=img.src
HEIGHT=img.offsetHeight;
WIDTH=img.offsetWidth;
TopLocation=img.offsetTop;
LeftLocation=img.offsetLeft;
}
|
|
|
|
|
Hello Everybody
I'm sending the mail i'm receiving blank text or nothing or sometimes i got error ...................
I'm putting my code here plz have a look and suggest me the problem exists in my code
I've already taken following controls.......given below
hidden Field= txtID
IFRAME = manojTextBox
-----------------------------------------------------------
Page_Load
if(!Page.IsPostBack)
{
cmdClick.Attributes.Add("onClick","document.Form1.txtID.value=manojTextBox.document.body.innerHTML");
}
-----------------------------------------------------------
Click Event
MailMessage mail1=new MailMessage();
mail1.To="mail@saamstesting.com";
mail1.From="manoj.manojbisht@gmail.com";
mail1.Subject="This is New Mail -2";
mail1.Priority=MailPriority.High;
mail1.BodyFormat=MailFormat.Html;
mail1.Body=Request.Form["txtID"];
try
{
SmtpMail.SmtpServer="mail.saamstesting.com";
SmtpMail.Send(mail1);
lblMsg.Text="Mail Sent Successfully";
lblMsg.ForeColor=Color.DarkBlue;
}
catch(Exception ex)
{
lblMsg.Text=ex.Message.ToString();
lblMsg.ForeColor=Color.Red;
}
|
|
|
|
|
The Knowledge wrote: cmdClick.Attributes.Add("onClick","document.Form1.txtID.value=manojTextBox.document.body.innerHTML");
try something like this instead
var iFrame= document.getElementById("IFrame1");<br />
document.getElementById("txtID").value = iFrame.document.innerHTML;
and have a look at the below link
How to send SMTP mail in ASP.NET using C# technology[^]
Regards J O H N
"Even eagles need a push." David McNally
|
|
|
|
|
Hello
I am a beginner and I really need hlp
The problem is that :-
I want to display the Button id of the button which has been clicked on a new page on being clicked and the text also i mean buton.text.
Mrinal
|
|
|
|
|
Do you mean that you want to pass the button ID and TEXT to the new page on the click of a Button? If yes...
On the button click event use Reponse.Redirect to call the new page. Along wi the page URL you can pass the button ID and TEXT as query string values.
something like this...
Response.Redirect("NewPage.aspx?btnId=" + btn.ID + "&btntext=" + btn.Text, False)
and In the New page you can retrieve the values using Request object.
Request.QueryString("btnId")<br />
Request.QueryString("btntext")
the above statement will give you the vaues that you passed from the actual page.
Regards J O H N
"Even eagles need a push." David McNally
|
|
|
|
|
Thanks..
I have 4 buttons on my page .It worked for the first button but didn't work for the rest others ..
Mrinal
|
|
|
|
|
can we define the table and div property in the skin file in asp.net
please help me.
Piyush Vardhan Singh
Senior Software Engineer
TAS NewDelhi
India
|
|
|
|
|
Piyush Vardhan Singh wrote: can we define the table and div property in the skin file in asp.net
Skins: Allow you to define individual HTML Elements and Web control styles.
Regards J O H N
"Even eagles need a push." David McNally
|
|
|
|
|
thanks for reply.
First time i have using skin file.i want to use many ui for single page. please if u have any example or link then please give me.
thanks
Piyush Vardhan Singh
Senior Software Engineer
TAS NewDelhi
India
|
|
|
|
|
|
Hi All,
I need to Implement Remember Me functionality using ASP.NET 2.0. When I enter user name and password for the first time then windows ask me that whether u want to save this passowrd or not, but I dont want it in this way.
When check the checkbox of Remember Me on this Computer then it should be saved and next time when i press first letter of login name then it should display the list of all names starting with that first letter. When I select the user name it should automatically displays the password and when I clicked on login button tis should all the FormsAuthentication and redirect to valid page.
Please help me...
|
|
|
|
|
Use cookies to manage
I Love SQL
|
|
|
|
|
Thanks for replying.
I did that but Im not getting how to display list of user names visited the site from my machine or say how will I get the list of user names in the User name textbox??
Please help me...
|
|
|
|
|
You have to store the UserName in Cookie and when the request occure then you have to check the cookie for UserName is Exists then assign to textbox
Best Regards,
Chetan Patel
|
|
|
|
|
Thanks Chetan, it will be very greatful if u help me with some code also.
Thanks again.
|
|
|
|