Click here to Skip to main content
15,878,430 members
Home / Discussions / C#
   

C#

 
GeneralWeb Service Question Pin
Mazdak17-Jan-04 20:25
Mazdak17-Jan-04 20:25 
GeneralRe: Web Service Question Pin
Heath Stewart18-Jan-04 11:19
protectorHeath Stewart18-Jan-04 11:19 
GeneralTesting Distributed Applications Pin
Mohamad Al Husseiny17-Jan-04 19:26
Mohamad Al Husseiny17-Jan-04 19:26 
GeneralRe: Testing Distributed Applications Pin
Heath Stewart18-Jan-04 11:17
protectorHeath Stewart18-Jan-04 11:17 
GeneralRe: Testing Distributed Applications Pin
Mohamad Al Husseiny18-Jan-04 15:08
Mohamad Al Husseiny18-Jan-04 15:08 
GeneralRe: Testing Distributed Applications Pin
Heath Stewart19-Jan-04 3:02
protectorHeath Stewart19-Jan-04 3:02 
GeneralRe: Testing Distributed Applications Pin
Mohamad Al Husseiny19-Jan-04 20:09
Mohamad Al Husseiny19-Jan-04 20:09 
Generalproblem in reading from DB Pin
hadi20sa17-Jan-04 17:50
hadi20sa17-Jan-04 17:50 
Hi everyone
I have a problem when i try to read from database. the exception message says
Unspecified error: E_FAL_(0x80004005)

any one can help me?
The code is included in this file

the source code is also here
-----------------------------------------
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.OleDb;

namespace blood
{
///
/// Summary description for Form1.
///

public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Button button1;
private System.Data.OleDb.OleDbCommand oleDbCommand1;
private System.Data.OleDb.OleDbConnection oleDbConnection1;
///
/// Required designer variable.
///

private System.ComponentModel.Container components = null;

public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();

//
// TODO: Add any constructor code after InitializeComponent call
//
}

///
/// Clean up any resources being used.
///

protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///

private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
this.panel1 = new System.Windows.Forms.Panel();
this.label2 = new System.Windows.Forms.Label();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.oleDbCommand1 = new System.Data.OleDb.OleDbCommand();
this.oleDbConnection1 = new System.Data.OleDb.OleDbConnection();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// panel1
//
this.panel1.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
this.panel1.Controls.AddRange(new System.Windows.Forms.Control[] {
this.pictureBox1,
this.label2});
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(424, 64);
this.panel1.TabIndex = 0;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(225, 24);
this.label2.Name = "label2";
this.label2.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.label2.Size = new System.Drawing.Size(174, 13);
this.label2.TabIndex = 1;
this.label2.Text = "ÇáÑÌÇÁ ßÊÇÈÉ ßáãÉ ÇÓã ÇáãÓÊÎÏã æ ßáãÉ ÇáãÑæÑ";
//
// pictureBox1
//
this.pictureBox1.Image = ((System.Drawing.Bitmap)(resources.GetObject("pictureBox1.Image")));
this.pictureBox1.Location = new System.Drawing.Point(16, 8);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(48, 48);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.pictureBox1.TabIndex = 2;
this.pictureBox1.TabStop = false;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(283, 105);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(54, 13);
this.label3.TabIndex = 1;
this.label3.Text = "ÇÓã ÇáãÓÊÎÏã";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(289, 145);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(48, 13);
this.label4.TabIndex = 2;
this.label4.Text = "ßáãÉ ÇáãÑæÑ";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(64, 101);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(200, 20);
this.textBox1.TabIndex = 3;
this.textBox1.Text = "";
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(63, 141);
this.textBox2.Name = "textBox2";
this.textBox2.PasswordChar = '*';
this.textBox2.Size = new System.Drawing.Size(200, 20);
this.textBox2.TabIndex = 4;
this.textBox2.Text = "";
//
// button1
//
this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.button1.Location = new System.Drawing.Point(272, 189);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(80, 24);
this.button1.TabIndex = 5;
this.button1.Text = "ÏÎæá";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// oleDbCommand1
//
this.oleDbCommand1.CommandText = "SELECT id, name, [password] FROM names WHERE (id = ?) AND ([password] = ?)";
this.oleDbCommand1.Connection = this.oleDbConnection1;
this.oleDbCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("id", System.Data.OleDb.OleDbType.VarWChar, 15, "id"));
this.oleDbCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("password", System.Data.OleDb.OleDbType.VarWChar, 15, "password"));
//
// oleDbConnection1
//
this.oleDbConnection1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=muneer.mdb;Persist Security Info=Fal" +
"se;\0";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(424, 230);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.button1,
this.textBox2,
this.textBox1,
this.label4,
this.label3,
this.panel1});
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.Name = "Form1";
this.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "ÏÎæá";
this.panel1.ResumeLayout(false);
this.ResumeLayout(false);

}
#endregion

///
/// The main entry point for the application.
///

[STAThread]
static void Main()
{
Application.Run(new Form1());
}

private void button1_Click(object sender, System.EventArgs e)
{
string sql = "SELECT id, name, [password] FROM names WHERE (id ='"+textBox1.Text+"') AND ([password] ='"+textBox2.Text+"')";
try
{
OleDbDataReader objReader;
//oleDbCommand1.Parameters["id"].Value = textBox1.Text.Trim();
//oleDbCommand1.Parameters["password"].Value = textBox2.Text.Trim();
oleDbConnection1.Open ();
oleDbCommand1.CommandText = sql;

objReader = oleDbCommand1.ExecuteReader();
if(objReader.Read())
{
//ss = objReader["name"].ToString();
objReader.Close();
this.Close();
}
}
catch(ArgumentNullException ex)
{
MessageBox.Show(this,"Error 4"+ex.Message,"Error...");
}
catch(Exception ex)
{
MessageBox.Show(this,"Error 3 "+" \n"+ex.Message,"Error...");
}
finally
{
oleDbConnection1.Close();
}

}


}
}

-----------------------------------------
GeneralRe: problem in reading from DB Pin
Rocky Moore17-Jan-04 18:44
Rocky Moore17-Jan-04 18:44 
QuestionHow do you make a .net component run as an embedded resource? Pin
Arg...darn anynomous mode lol17-Jan-04 15:36
sussArg...darn anynomous mode lol17-Jan-04 15:36 
AnswerRe: How do you make a .net component run as an embedded resource? Pin
Colin Angus Mackay17-Jan-04 15:42
Colin Angus Mackay17-Jan-04 15:42 
QuestionHow do you make a .net component run as an embedded resource? Pin
Anonymous17-Jan-04 15:34
Anonymous17-Jan-04 15:34 
AnswerRe: How do you make a .net component run as an embedded resource? Pin
Arjan Einbu18-Jan-04 4:19
Arjan Einbu18-Jan-04 4:19 
AnswerRe: How do you make a .net component run as an embedded resource? Pin
Heath Stewart18-Jan-04 11:15
protectorHeath Stewart18-Jan-04 11:15 
QuestionShould I keep using it or should I change? Pin
caheo17-Jan-04 14:25
caheo17-Jan-04 14:25 
GeneralBUG: Graphics.DrawString Pin
leppie17-Jan-04 11:25
leppie17-Jan-04 11:25 
GeneralWhat do you want to do today? Pin
leppie17-Jan-04 11:52
leppie17-Jan-04 11:52 
QuestionHow do you think about delegate in c#? Pin
Forrest Feather17-Jan-04 9:50
Forrest Feather17-Jan-04 9:50 
AnswerRe: How do you think about delegate in c#? Pin
Forrest Feather17-Jan-04 9:56
Forrest Feather17-Jan-04 9:56 
AnswerRe: How do you think about delegate in c#? Pin
Nick Parker17-Jan-04 10:35
protectorNick Parker17-Jan-04 10:35 
AnswerRe: How do you think about delegate in c#? Pin
Heath Stewart17-Jan-04 10:57
protectorHeath Stewart17-Jan-04 10:57 
GeneralRe: How do you think about delegate in c#? Pin
Colin Angus Mackay17-Jan-04 11:16
Colin Angus Mackay17-Jan-04 11:16 
GeneralRe: How do you think about delegate in c#? Pin
Heath Stewart17-Jan-04 11:19
protectorHeath Stewart17-Jan-04 11:19 
GeneralCheck if app is themed Pin
Roger Alsing17-Jan-04 8:56
Roger Alsing17-Jan-04 8:56 
GeneralRe: Check if app is themed Pin
Heath Stewart17-Jan-04 10:40
protectorHeath Stewart17-Jan-04 10:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.