That would help sorry here is the
code.
From: Jonel Rienton [mailto:[EMAIL PROTECTED]
Sent: Friday, February 10, 2006 4:20 PM
To: 'Javier Ruiz'; mono-devel-list@lists.ximian.com
Subject: RE: [Mono-dev] Issue Compiling on Red Hat Linux
hard to help without seeing any
code
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Javier Ruiz
Sent: Friday, February 10, 2006 4:08 PM
To: mono-devel-list@lists.ximian.com
Subject: [Mono-dev] Issue Compiling on Red Hat Linux
I'm running mono and
I compile my program ok but when I run the program I get the following error. I
can run the program on windows with no problems.
ERROR:
Unhandled Exception:
System.InvalidCastExeception: Cannot cast from source type to destination
type.
Javier
Ruiz
Oracle
DBA
--
No virus found in this incoming message.
Checked by AVG
Free Edition.
Version: 7.1.375 / Virus Database: 267.15.4/255 - Release Date:
2/9/2006
using System; using System.Collections.Generic; using System.Text; using System.IO; using System.Data; using System.Data.OracleClient; using System.Net.Mail;
namespace MontitorDatabase { class Program { static void Main(string[] args) { //Creating connection string connectionString = "Data Source=EMREP;" + "User ID=system;" + "Password=c0mm0d0r3;"; OracleConnection dbconn = null; dbconn = new OracleConnection(connectionString); try { dbconn.Open(); OracleCommand dbcmd = dbconn.CreateCommand(); string sql = "select sysdate,status from v$instance"; dbcmd.CommandText = sql; OracleDataReader dbreader = dbcmd.ExecuteReader(); while (dbreader.Read()) { string sysdate = (string)dbreader["sysdate"]; string status = (string)dbreader["status"]; System.Console.WriteLine("Date: {0} Status: {1}", sysdate, status); } } catch (NullReferenceException ex) { // System.Console.WriteLine(ex.Message); // FileStream file = new FileStream("db_montior.txt", FileMode.Create, FileAccess.Write); // StreamWriter sw = new StreamWriter(file); // sw.Write(ex.Message); // sw.Close(); // System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage(); // message.To.Add("[EMAIL PROTECTED];javierruiz@"); // message.Subject = "Test C# Mail"; // message.From = new System.Net.Mail.MailAddress("[EMAIL PROTECTED]"); // message.Body = ex.Message; // System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("grante2k.grantprideco.cc"); // smtp.Send(message); } finally { dbconn.Close(); } } } }
_______________________________________________ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list