473,385 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

c# connection to odbc driver no output

Expand|Select|Wrap|Line Numbers
  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Web;
  5. using System.Web.Security;
  6. using System.Web.UI;
  7. using System.Web.UI.WebControls;
  8. using System.Web.UI.WebControls.WebParts;
  9. using System.Web.UI.HtmlControls;
  10. using System.Data;
  11. using System.Data.Odbc;
  12.  
  13.  
  14. public partial class _Default : System.Web.UI.Page 
  15. {
  16.     protected void Page_Load(object sender, EventArgs e)
  17.     {
  18.         string connectionString =
  19.             "DSN=infofyp;" +
  20.             "UID=db2admin;" +
  21.             "PWD=palmolive";
  22.         IDbConnection dbcon;
  23.         dbcon = new OdbcConnection (connectionString);
  24.         dbcon.Open();
  25.         IDbCommand dbcmd = dbcon.CreateCommand();
  26.  
  27.         //connecting to the table info_db2
  28.  
  29.         string sql =
  30.             "SELECT p_id " +
  31.             "FROM deepa.info";
  32.  
  33.         dbcmd.CommandText = sql;
  34.         IDataReader reader = dbcmd.ExecuteReader();
  35.         while (reader.Read())  {
  36.             string Identification = (string) reader ["p_id"];
  37.             Console.WriteLine ("Indentification: " + Identification);
  38.         }
  39.  
  40.         //cleaning up
  41.         reader.Close();
  42.         reader = null;
  43.         dbcmd.Dispose();
  44.         dbcmd = null;
  45.         dbcon.Close();
  46.         dbcon = null;
  47.     }
  48.  
  49. }

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.
Mar 26 '07 #1
1 892
kenobewan
4,871 Expert 4TB
This is a web application and you are using a browser? So what does console.writeline do?
Mar 27 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: GitarJake | last post by:
Hello all, I am trying to test an ODBC connection to an Oracle dbf using the ODBC Data Source Administrator. It's not working and I suspect I haven't configured Oracle correctly. Below is...
2
by: Ben | last post by:
Hi, I have a problem connecting to Oracle using and ODBC connection in a ASP.Net web page. The TNS Names works fine because when I create a DSN it works, and it works in SQL Plus. Here are...
8
by: Greg Strong | last post by:
Hello All, The short questions are 1 Do you know how to make DSN connection close in Access to Oracle 10g Express Edition? &/or 2 Do you know how to make a DSN-less pass-through query...
7
by: Bill Nguyen | last post by:
I have this connection string using ODBC DSN Dim FactorJaco As String = "dsn=jaco;catalog=factor;uid=user;pwd=passord" This requires an ODBC DSN (jaco) at every client PC. I need to use DSN-less...
3
by: GitarJake | last post by:
Hello all, I am trying to test an ODBC connection to an Oracle dbf using the ODBC Data Source Administrator. It's not working and I suspect I haven't configured Oracle correctly. Below is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.