0

error connecting to databaseAccess denied for use 'root'@'localhost(using password:YES)

using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MySql.Data.MySqlClient;
using System.Windows.Forms;
using DPUruNet;
using System.Drawing.Imaging;
using System.Drawing;

namespace UareUBiometrics
{
    class HelperFunctions
    {
        private static Fmd[] fmds;

        private static Fmd[] allDBFmds;
        public static Fmd[] GetAllFmds
        {
            get { return allDBFmds; }

        } 

        private static string[] allUserNames;
        public static string[] GetAllUserNames
        {
            get { return allUserNames; }
        }

        private static int[] allfingerIDs;
        public static int[] GetallfingerIDs
        {
            get { return allfingerIDs; }
        }

        public static MySqlDataReader ConnectDBnExecuteSelectScript(string Script)
        {
            string connectionString = "server=localhost;User Id=root;database=customerInfo;Password=";
            MySqlDataReader dataReader = null;
            MySqlConnection conn = new MySqlConnection(connectionString);
            try
            {
                conn.Open();
                MySqlCommand sqlCommand = new MySqlCommand(Script, conn);
                dataReader = sqlCommand.ExecuteReader(CommandBehavior.CloseConnection);

            }
            catch (MySqlException ex)
            {
                MessageBox.Show("Error opening connection" + ex.Message);
            }

            return dataReader;
        }
3
Contributors
2
Replies
5
Views
4 Years
Discussion Span
Last Post by kyle.santelices.31
0

at this below line your not passing the password
string connectionString = "server=localhost;User Id=root;database=customerInfo;Password=";

0

Pgmer - what if i dont have password ,what is the correct syntax because im also using that line of codes

string connectionString = "server=localhost;User Id=root;database=customerInfo;Password=";

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.