Click here to Skip to main content
15,891,828 members
Home / Discussions / C#
   

C#

 
AnswerRe: transferring images from server to winforms application - smallest possible size Pin
Christian Graus20-Dec-08 14:11
protectorChristian Graus20-Dec-08 14:11 
AnswerRe: transferring images from server to winforms application - smallest possible size Pin
leppie20-Dec-08 19:53
leppie20-Dec-08 19:53 
GeneralRe: transferring images from server to winforms application - smallest possible size Pin
Christian Graus20-Dec-08 23:08
protectorChristian Graus20-Dec-08 23:08 
GeneralRe: transferring images from server to winforms application - smallest possible size Pin
Mark Salsbery22-Dec-08 8:00
Mark Salsbery22-Dec-08 8:00 
QuestionHow to display the Build number in a text box? (I'm a newbie to C#) Pin
Albert Giraudi20-Dec-08 5:33
Albert Giraudi20-Dec-08 5:33 
AnswerRe: How to display the Build number in a text box? (I'm a newbie to C#) [modified] Pin
Luc Pattyn20-Dec-08 6:30
sitebuilderLuc Pattyn20-Dec-08 6:30 
AnswerRe: How to display the Build number in a text box? (I'm a newbie to C#) Pin
RobScripta20-Dec-08 15:47
professionalRobScripta20-Dec-08 15:47 
Questionc# login help Pin
cobalt-rose20-Dec-08 1:51
cobalt-rose20-Dec-08 1:51 
Hello i am new to this place and thought id have a look around before i post a question but i was unable to find the answer to my problem.

I am very new to c# and creating winform application and require a login that will allow access to the application window.

I am using a mysql database with phpmyadmin and trying to autheticate the login using a ole db connection.

I have been trying to get this working for a while now and have made some progress but i am now getting the ERROR MESSAGE: (MYsql prov provider is not registered on the local machine) when ever i run the application and input a username and password and click OK.

Any help would greatly be appreciated.
Thanks in advacnced

My code is below:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;


namespace _Consultants
{
public partial class Form1 : Form
{
public static string ConnectionString = "Provider=MySQLProv;Data Source=_consultants;User Id=root;Password=password;";
public Form1()
{
InitializeComponent();

}

private void textBox2_TextChanged(object sender, EventArgs e)
{


}

private void button1_Click(object sender, EventArgs e)
{
OleDbConnection myConnection = new OleDbConnection(ConnectionString);

string uname;
string pword;

try
{
uname = textBox1.Text;
pword = textBox2.Text;

{
OleDbCommand myCommand = new OleDbCommand("Select count(*) from user where username = ' " + textBox1.Text + " 'and password=' " + textBox2.Text + " ' ");
myCommand.Connection = myConnection;
myConnection.Open();
int count = Convert.ToInt16 (myCommand.ExecuteScalar());

// Notice the double equal signs.
// Double equal signs are a comparison.
// Single equal signs are an assignment.
if (count > 0)
{
main_screen main = new main_screen();
main.Show();
this.Hide();
}

else
{
Application.Exit();
}
}
}
catch (Exception ex)
{
myConnection.Close();
MessageBox.Show("Wrong Input Entered", "Window Information"+ex.Message.ToString(),
MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
}
AnswerRe: c# login help Pin
N a v a n e e t h20-Dec-08 2:17
N a v a n e e t h20-Dec-08 2:17 
GeneralRe: c# login help Pin
cobalt-rose20-Dec-08 2:32
cobalt-rose20-Dec-08 2:32 
AnswerRe: c# login help Pin
Christian Graus20-Dec-08 10:14
protectorChristian Graus20-Dec-08 10:14 
AnswerRe: c# login help Pin
RobScripta20-Dec-08 16:01
professionalRobScripta20-Dec-08 16:01 
GeneralRe: c# login help Pin
cobalt-rose21-Dec-08 1:49
cobalt-rose21-Dec-08 1:49 
GeneralRe: c# login help Pin
RobScripta21-Dec-08 20:58
professionalRobScripta21-Dec-08 20:58 
GeneralRe: c# login help Pin
cobalt-rose22-Dec-08 13:19
cobalt-rose22-Dec-08 13:19 
GeneralRe: c# login help Pin
RobScripta22-Dec-08 23:49
professionalRobScripta22-Dec-08 23:49 
GeneralRe: c# login help Pin
cobalt-rose23-Dec-08 22:18
cobalt-rose23-Dec-08 22:18 
GeneralRe: c# login help Pin
RobScripta23-Dec-08 22:58
professionalRobScripta23-Dec-08 22:58 
GeneralRe: c# login help Pin
cobalt-rose24-Dec-08 1:56
cobalt-rose24-Dec-08 1:56 
GeneralRe: c# login help Pin
RobScripta24-Dec-08 3:45
professionalRobScripta24-Dec-08 3:45 
GeneralRe: c# login help Pin
cobalt-rose24-Dec-08 13:05
cobalt-rose24-Dec-08 13:05 
GeneralRe: c# login help Pin
RobScripta24-Dec-08 20:50
professionalRobScripta24-Dec-08 20:50 
QuestionDowngrading ReaderWriterLockSlim UpgradeableReadLock to simple ReadLock Pin
HosamAly19-Dec-08 23:28
HosamAly19-Dec-08 23:28 
AnswerRe: Downgrading ReaderWriterLockSlim UpgradeableReadLock to simple ReadLock Pin
N a v a n e e t h20-Dec-08 0:57
N a v a n e e t h20-Dec-08 0:57 
GeneralRe: Downgrading ReaderWriterLockSlim UpgradeableReadLock to simple ReadLock Pin
HosamAly20-Dec-08 2:41
HosamAly20-Dec-08 2:41 

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.