Home problems with calling helperfunction
Reply: 0

problems with calling helperfunction

pfandflaschen Published in 2017-12-07 20:38:58Z

hi in one of my cshtml's i call my helperfunction. but my programm wont go into it.

code-part (where i call the function):

if (var1== 0)
  <div class="row"><p> available products </p> </div> 


@using System.Configuration;
@using MySql.Data.MySqlClient;

@helper helperfct(int x)
 const string constring = 
 MySqlConnection con = new MySqlConnection(constring);

MySqlCommand cmd;

cmd = con.CreateCommand();
cmd.CommandText = "SELECT name FROM products WHERE ID =" + x;

MySqlDataReader r = cmd.ExecuteReader();

while (r.Read())
   <h2> available products (@r["name"])</h2>

catch (Exception e)
    <p class="error">error.error.error</p>

the program jumps to the helperpage with the helperfunction to the function but won't go in it (directly jumps to the end).

any idea what might be the cause for this?

thanks in advance for answering.

total newbie to this so please lots of explaining

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.314288 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO