Adesanya Olusegun

Adesanya Olusegun

  • NA
  • 19
  • 26.7k

input string does not contain a valid encoding of the 'RSA'

May 26 2014 8:58 AM
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;
using System.Data.OleDb;
using System.ComponentModel;
using System.Threading;

namespace DiaryApps
{

static class Program
{

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
bool InstanceCountOne = false;

using (Mutex mtex = new Mutex(true, "DiaryApps", out InstanceCountOne))
{
if (InstanceCountOne)
{

Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new RegistrationForm());
// what am trying to do here is load the registration page once and to load the Login page for other subsequent logins
OleDbConnection newConnection;
OleDbCommand cmd = new OleDbCommand();
string Connection = @" provider=Microsoft.Jet.OLEDB.4.0; data source='Diarydatabase.mdb'; Jet OLEDB:Database Password= segunsco";
newConnection = new OleDbConnection(Connection);
newConnection.Open();
cmd.CommandText = "if exist(select Flag from createdDetails) begin select '1' end else begin select '0' end";
OleDbDataReader MotReader = cmd.ExecuteReader();
if (MotReader.HasRows)
{
while (MotReader.Read())
{
string ty = MotReader.GetString(0);
if (ty == "0")
{
Application.Run(new RegistrationForm());
}
else if (ty == "1")
{
Application.Run(new Login());
}
}

}

}
else
{
MessageBox.Show("An instance of the application is already running");
}
}
}



}
}