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

Edited 3 Years Ago by pritaeas: Moved.

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

Edited 3 Years Ago by kyle.santelices.31: spelling

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

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;

Edited 3 Years Ago by samsylvestertty

This article has been dead for over six months. Start a new discussion instead.