User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 402,097 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,508 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 408 | Replies: 1
Reply
Join Date: Jan 2008
Posts: 13
Reputation: Yuexuan is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
Yuexuan Yuexuan is offline Offline
Newbie Poster

How to show output with my condition from table with vb.net

  #1  
Mar 25th, 2008
Here is my mysql table need retrieve data

total table
MPN AML Onhand Demand
2 P 300 200
2 A 300 200
3 P 100 200
3 A 300 200
4 A 200 300

here is my output need
output
MPN AML Onhand Demand
2 P 300 200
3 A 300 200

How to retrieve data from total table that output result i need
here is my condition alway take aml type P is priority
if Ohand > demand then
show aml type P data
else
then take aml type A to compare
if aml type A Ohand >demand then
show aml type A data
else ignore it don't show aml type A and P
like output i need
i have tired before but it only appear aml type either A or P data
i am using mysql database store
how to appear aml type A and P simultaneous data that output table i show
Any 1 can show me solution with vb.net ??helpful appreciated
thx
Newbie for programming
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Sep 2007
Posts: 1,057
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 61
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

Re: How to show output with my condition from table with vb.net

  #2  
Mar 28th, 2008
You can do this through vb.net or you can do it through your SQL query.

If you are not going to use a stored procedure, I would recommend sorting through it from your code, and just selecting all of what you need.
SELECT * FROM tbl

<script language="vb" runat="server">
Function chkArgs(ByVal mpn As Short, ByVal aml As Char, ByVal onhand As Integer, ByVal demand As Integer)
  If aml = "P" And onhand >= demand Then
    'Do your data here
  ElseIf aml = "A" And onhand >= demand Then
    'Do your data here
  End If
End Function
</script>
Just call the function everytime you need the data.

chkArgs(<%# Eval("mpn") %>,<%# Eval("aml") %>,<%# Eval("onhand") %>,<%# Eval("demand") %>)
I answer pm's.
I answer questions.
I answer quickly.
I answer.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb ASP.NET Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Other Threads in the ASP.NET Forum

All times are GMT -4. The time now is 1:54 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC