topical media & game development

talk show tell print

server-mysql-code-ch19-examples.txt / txt



  
  /* Chapter 19 - Examples */
  
  while(dataReader.Read())
  {
     int cdId = (int) dataReader["CDID"];
     string cdName = (string) dataReader["CDName"];
  }
  
  if (compName.Length > 0)
  {
     <take action if length is greater than zero>
  }
  
  if ("Chopin".Equals(compName))
  {
     <take action if values are equal>
  }
  
  if("Classical".equals(strDept))
  {
     Response.Redirect("ClassicalSpecials.aspx");
  }
  
  if("Classical".equals(strDept))
  {
     %>
     <!-- #Include File="ClassicalSpecials.aspx" -->
     <%
  }
  
  try
  {
     <C# application code>
  }
  catch(Exception ex)
  {
     throw ex;
  }
  
  param[0] = new OdbcParameter("", OdbcType.VarChar);
  param[0].Value = cdName;
  param[1] = new OdbcParameter("", OdbcType.Int);
  param[1].Value = inStock;
  
  String deleteSQL = "DELETE FROM CDs WHERE CDID = ?";
  OdbcCommand comm = new OdbcCommand(deleteSQL, conn);
  OdbcParameter param = new OdbcParameter("", OdbcType.Int);
  param.Value = cdId;
  comm.Parameters.Add(param);
  comm.ExecuteNonQuery();
  
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.