Click here to Skip to main content
15,884,836 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to restart a Programm in Release-Modus per Code Pin
Member 1191673511-Apr-16 20:38
Member 1191673511-Apr-16 20:38 
GeneralRe: How to restart a Programm in Release-Modus per Code Pin
Pete O'Hanlon11-Apr-16 21:44
mvePete O'Hanlon11-Apr-16 21:44 
AnswerRe: How to restart a Programm in Release-Modus per Code Pin
ZurdoDev12-Apr-16 1:08
professionalZurdoDev12-Apr-16 1:08 
QuestionFiltering - C# winform connected to Access DB Pin
Kipp Doré10-Apr-16 12:51
Kipp Doré10-Apr-16 12:51 
AnswerRe: Filtering - C# winform connected to Access DB Pin
Garth J Lancaster10-Apr-16 13:11
professionalGarth J Lancaster10-Apr-16 13:11 
AnswerRe: Filtering - C# winform connected to Access DB Pin
Richard Andrew x6410-Apr-16 14:56
professionalRichard Andrew x6410-Apr-16 14:56 
AnswerRe: Filtering - C# winform connected to Access DB Pin
Richard Deeming11-Apr-16 1:39
mveRichard Deeming11-Apr-16 1:39 
QuestionSelection logic problem Pin
mekubo9-Apr-16 22:31
mekubo9-Apr-16 22:31 
C#
Hi guys,
 
I am trying to check for inventory quantity in database. If quatinty entered in dispatch webform is less than inventory, the dispatch should continue. else i should see error message that dispatch quantity is more than inventory and terminate the process.
 
My code below gives the following results:
When i try dispatching quantity less than inventory, the error still pops up and the program does not continue to excecute dispatch.  i do not want this. 
 
I am implementing the code from addbutton that should insert item to gridview (only if quantity is more than inventory). 
 
 
 
 
 
 
int SelectedDPItem;
int InventoryQTY;
int DinventoryQTY;

SqlConnection Connection = new SqlConnection("Data Source=localhost;Initial Catalog=warehousedb;Integrated Security=True ");
SqlDataAdapter INVadapter = new SqlDataAdapter("Select ItemID, ItemName, Quantity FROM inventory ", Connection);

SelectedDPItem = int.Parse(DropDownListItem_D.SelectedValue.ToString());
// Open Connection
Connection.Open();
SqlCommand Inventorychkcommand = new SqlCommand(("Select Quantity FROM inventory " + ("WHERE (ItemName LIKE \'"
+ (DropDownListItem_D.Text + "\')"))), Connection);
InventoryQTY = Convert.ToInt32(Inventorychkcommand.ExecuteScalar());
DinventoryQTY = Convert.ToInt32(txtQuantity_D.Text);



if (InventoryQTY < DinventoryQTY)
{

{

ClientScript.RegisterStartupScript(this.GetType(), "key", "<script>alert('sorry , Stock Balance is less than requested quantity.')</script>");
}
}


else
{

{
// procedure of inserting the record
AddNewRecordRowToGrid();

txtwaybill_D.Enabled = false;
DropDownListTransp.Enabled = false;
txtTruckNo_D.Enabled = false;
txtDrivername_D.Enabled = false;
DropDownListEmployee_D.Enabled = false;
btnNew.Enabled = false;
btnPostDispatch.Enabled = true;

DropDownListItem_D.Enabled = false;
txtDispatchDate.Enabled = false;
txtDestn.Enabled = false;
txtQuantity_D.Enabled = false;
txtDestn.Enabled = false;
}

AnswerRe: Selection logic problem Pin
OriginalGriff9-Apr-16 22:34
mveOriginalGriff9-Apr-16 22:34 
QuestionDobble Buffering Pin
FukkPhag19-Apr-16 20:23
FukkPhag19-Apr-16 20:23 
AnswerRe: Dobble Buffering Pin
OriginalGriff9-Apr-16 20:46
mveOriginalGriff9-Apr-16 20:46 
GeneralMessage Closed Pin
10-Apr-16 8:55
FukkPhag110-Apr-16 8:55 
GeneralRe: Dobble Buffering Pin
CHill6010-Apr-16 9:49
mveCHill6010-Apr-16 9:49 
GeneralRe: Dobble Buffering Pin
OriginalGriff10-Apr-16 20:58
mveOriginalGriff10-Apr-16 20:58 
AnswerRe: Dobble Buffering Pin
leon de boer9-Apr-16 22:20
leon de boer9-Apr-16 22:20 
GeneralRe: Dobble Buffering Pin
FukkPhag110-Apr-16 8:48
FukkPhag110-Apr-16 8:48 
AnswerRe: Dobble Buffering Pin
Eddy Vluggen10-Apr-16 10:10
professionalEddy Vluggen10-Apr-16 10:10 
QuestionData Entry application using strongly typed dataset Pin
Rajesh Thampi9-Apr-16 18:09
Rajesh Thampi9-Apr-16 18:09 
AnswerRe: Data Entry application using strongly typed dataset Pin
Eddy Vluggen10-Apr-16 10:17
professionalEddy Vluggen10-Apr-16 10:17 
QuestionCalls a method c# Pin
Bougarra8-Apr-16 1:18
Bougarra8-Apr-16 1:18 
AnswerRe: Calls a method c# Pin
OriginalGriff8-Apr-16 1:30
mveOriginalGriff8-Apr-16 1:30 
AnswerRe: Calls a method c# Pin
Richard MacCutchan8-Apr-16 2:49
mveRichard MacCutchan8-Apr-16 2:49 
AnswerRe: Calls a method c# Pin
Rahul Hanumant Chavan8-Apr-16 21:31
professionalRahul Hanumant Chavan8-Apr-16 21:31 
QuestionSpeed up code Pin
GrooverFromHolland8-Apr-16 0:37
GrooverFromHolland8-Apr-16 0:37 
AnswerRe: Speed up code Pin
OriginalGriff8-Apr-16 1:12
mveOriginalGriff8-Apr-16 1:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.