I am building winForm application, and i try to make a connection function for mssql Server but SqlConnection open/close always show "CS7069 C# Reference to type 'Component' claims it is defined in 'System', but it could not be found" how could I fix this issue?
public class SQLAPI
{
SqlConnection cn;
Boolean openConnect()
{
bool rtn = false;
try
{
cn = new SqlConnection("server=localhost;database=testDB;UID=ad;PWD=1234");
cn.Open();
}
catch (Exception e)
{
}
return rtn;
}
void closeConnect()
{
try {
cn.Close();
}
catch (Exception e)
{ }
}
}