I need to connect to a database from a c# unity script.
Its failing at the import stage though:
using System.Collections;
using System.Linq;
using System.Data;
using System.Data.SqlClient;
public class DatabaseConnector {
public List<string> getTopApps()
{
List<string> returnString = new List<string>();
string connectionString=
@"Data Source=myIP" +
@";Initial Catalog=myCatalog" +
@";User Id=username" +
@";Password=passwrd";
SqlConnection getConn = new SqlConnection(connectionString);
SqlCommand getComm = new SqlCommand("select * from applications",getConn);
try
{
getConn.open();
using (SqlDataReader reader = getComm.executeReader())
{
DataTable dt = new DataTable();
dt.Load(reader);
}
}
return returnString;
}
}
leads to error: