Image display by SQL command at c# , asp.net?

It's pretty hard to say without knowing what the data is!

It's pretty hard to say without knowing what the data is! A wild guess would be that an exception is thrown before the line if (itemsMin >= purchase). My first step would be to log the output of each sql statement, and also add logging if an exception is thrown in a try catch finally block.

For example: public int bla() { int itemsMin = -1; try { SqlConnection connection = new SqlConnection("Data Source=tcp:**. ****;Initial Catalog=*****;User ID=****;Password=****;Integrated Security=False;"); string commandtext = "SELECT Minbuy FROM items"; SqlCommand command = new SqlCommand(commandtext, connection); connection.Open(); itemsMin = (int)command.ExecuteScalar(); string commandtext2 = "SELECT purchaseid FROM purchase"; SqlCommand command2 = new SqlCommand(commandtext2, connection); int purchase = (int)command2.ExecuteScalar(); if (itemsMin >= purchase) image3. Visible = true; else image4.

Visible = true; connection.Close(); } catch (System. Exception ex) { System.Diagnostics.Trace. WriteLine(ex); } return itemsMin; }.

I wrote this code without trully knowladge. As you can see i'm trying to write IF staetment on SQL tables at c#... and I don't know how to do that... – Bside Jun 9 at 11:42 I will be glad if you can give me an example for if statement on sql tables (2 different tables on the same database... let's call for one table : bla and for the second bla2 ... I need to chek one column at bla against one column at bla2. – Bside Jun 9 at 11:45 You don't think that I need to assign this method at the image:asp?

Maybe ondatatbinding event? – Bside Jun 9 at 11:47 No, this should work (on first sight). – RubenHerman Jun 9 at 12:04 1 Also try to perfect your queries in SQL Management Studio's "New Query" window.It will help you get the SQL syntax correct, and show you what results are being returned.

– Matt -The Hat- McVitie Jun 9 at 12:59.

At firts make images visibility to true and check is it visible in normal form if its is ,make visibility to true by hard coding not by select from sql,and if this step passed may be the sql returns bad value.

I've triyed to do int a = 5 int be = 6 ... if (a.

Try this on you're method: public int bla() { try{ //your code }catch(Exception ex){ System.Diagnostics.Debugger.Break(); Console. WriteLine(ex. Message); return -1; } } When the debugger starts, you've got an error in your code.

Hover over ex (in visual studio) to see more information about the error.

Thank you. What I need to write on the ex? I got error on the VWD : The variable 'ex' is decleard but never used... – Bside Jun 9 at 12:31 anyway... I wrote what you gave me here and I got on the page error: Compiler Error Message: CS0161: 'DMasterPage.bla()': not all code paths return a value – Bside Jun 9 at 12:32 In catch block write: Console.

WriteLine(ex. Message); return 0; – NitinJS Jun 9 at 12:49 I've edited the code. It's just because not all paths return a value.

– RubenHerman Jun 9 at 12:57.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions