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;
        }

Are you sure the user root, without a password, has access to your database?

pritaeas - yes i also that ,but when i use that in vb .it comes with an error

pritaeas - can you please help us thank you so much

I don't use MySQL but based on this , the connection string looks wrong. It looks more like a SQL Server connection string.

This should really be moved to the C# forum.

Does the root account exist in your local host MySQL server?
Does the root account exist without a password?

for 1 & 2 try to login to mysql with the username as root and empty string '' as password

If you could login with the given credentials
Try giving a password to the root account granting permissions in the MySQL command prompt

I hope the GRANT statement goes like this

GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY somepassword

replace somepassword with your password

and change the connection string

string connectionString = "server=localhost;User Id=root;database=customerInfo;Password=somepassword;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.