K
KaHuNa
this code works perfectly when i use it on the server where mySQL is
installed, but i have a security error when i use it on a client computer.
I don't know how i can change that.
using System;
using System.Data.Odbc;
class database
{
// OleDbConnection oConn;
// OleDbCommand oCmd;
public void setConnection()
{
string MyConString = "DRIVER={MySQL ODBC 3.51 Driver};" +
"SERVER=192.168.1.2;" +
"DATABASE=golf;" +
"UID=root;" +
"PASSWORD=;" +
"OPTION=3";
OdbcConnection myConnection = new OdbcConnection(MyConString);
try
{
// myConnection = new OleDbConnection(MyConString);
string mySelectQuery = "SELECT * FROM golfnews";
myConnection.Open();
OdbcCommand myCommand = new OdbcCommand(mySelectQuery, myConnection);
myCommand.CommandTimeout = 20;
OdbcDataReader myReader;
myReader = myCommand.ExecuteReader();
int i = 0;
while (myReader.Read())
{
Console.WriteLine(myReader.ToString() + i++ );
}
myReader.Close();
}
catch (Exception exc)
{
Console.WriteLine(exc.Message);
}
finally
{
myConnection.Close();
}
}
}
class Prog
{
static void Main()
{
database db1 = new database();
db1.setConnection();
}
}
installed, but i have a security error when i use it on a client computer.
I don't know how i can change that.
using System;
using System.Data.Odbc;
class database
{
// OleDbConnection oConn;
// OleDbCommand oCmd;
public void setConnection()
{
string MyConString = "DRIVER={MySQL ODBC 3.51 Driver};" +
"SERVER=192.168.1.2;" +
"DATABASE=golf;" +
"UID=root;" +
"PASSWORD=;" +
"OPTION=3";
OdbcConnection myConnection = new OdbcConnection(MyConString);
try
{
// myConnection = new OleDbConnection(MyConString);
string mySelectQuery = "SELECT * FROM golfnews";
myConnection.Open();
OdbcCommand myCommand = new OdbcCommand(mySelectQuery, myConnection);
myCommand.CommandTimeout = 20;
OdbcDataReader myReader;
myReader = myCommand.ExecuteReader();
int i = 0;
while (myReader.Read())
{
Console.WriteLine(myReader.ToString() + i++ );
}
myReader.Close();
}
catch (Exception exc)
{
Console.WriteLine(exc.Message);
}
finally
{
myConnection.Close();
}
}
}
class Prog
{
static void Main()
{
database db1 = new database();
db1.setConnection();
}
}