Expand|Select|Wrap|Line Numbers
- using System;
- using System.Data;
- using System.Configuration;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Web.UI.HtmlControls;
- using System.Data;
- using System.Data.Odbc;
- public partial class _Default : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- string connectionString =
- "DSN=infofyp;" +
- "UID=db2admin;" +
- "PWD=palmolive";
- IDbConnection dbcon;
- dbcon = new OdbcConnection (connectionString);
- dbcon.Open();
- IDbCommand dbcmd = dbcon.CreateCommand();
- //connecting to the table info_db2
- string sql =
- "SELECT p_id " +
- "FROM deepa.info";
- dbcmd.CommandText = sql;
- IDataReader reader = dbcmd.ExecuteReader();
- while (reader.Read()) {
- string Identification = (string) reader ["p_id"];
- Console.WriteLine ("Indentification: " + Identification);
- }
- //cleaning up
- reader.Close();
- reader = null;
- dbcmd.Dispose();
- dbcmd = null;
- dbcon.Close();
- dbcon = null;
- }
- }
any ideas on why I can't get any output? Perhaps there's something wrong with my code but when I 'view in browser' there's no error reported.
Please please please please help.