my code:
class Connection
{
public static string connectionString;
public DataTable ShowData(string s1)
{
OleDbConnection CN = new OleDbConnection();
CN.ConnectionString = connectionString;
CN.Open();
OleDbCommand CMT = new OleDbCommand(s1, CN);
OleDbDataReader da = CMT.ExecuteReader();
DataTable DT = new DataTable();
DT.Load(da);
CN.Close();
return DT;
}
public void SetData(string s2)
{
OleDbConnection CN = new OleDbConnection();
CN.ConnectionString = connectionString;
CN.Open();
OleDbCommand cmd = new OleDbCommand(s2, CN);
cmd.ExecuteNonQuery();
CN.Close();
}
public bool IsExist(string s3)
{
OleDbConnection CN = new OleDbConnection();
CN.ConnectionString = connectionString;
CN.Open();
OleDbCommand CMD = new OleDbCommand(s3, CN);
OleDbDataReader DR = CMD.ExecuteReader();
if (DR.Read())
return true;
return false;
CN.Close();
}
}
}
When i debug my program the below error appear how can i solve it?
Error:
An unhandled exception of type 'System.InvalidOperationException' occurred in System.Data.dll
Additional information: The ConnectionString property has not been initialized.