Hi people,
i am pretty new to c# and programming overall. I need to create an Android App for an exhibition we´ll be attending soon. When the visitor got all his infos etc. i want to make him enter his name and E-mail and save it for later use (like sending a newsletter etc.). By now i made one version where i save it to our mySQL Sever and one where i save it to an external txt file via Streamwriter. Both works fine on my PC but as soon as i export it to an Android device, the button that saved the data AND chages the scene just does not do ANYTHING. It does not have to be mySQL or saving to txt. I just need to save the data in any way at all.
If it helps, please see the example of the code i have so far for MySQL:
private const string CONNECTION = “SERVER=ourIP;PORT=ourPort;UID=myName;PASSWORD=myPW;DATABASE=exhibition;”;
public void AddSubscriber(){
MySqlConnection con = new MySqlConnection(CONNECTION);
Debug.Log("Connecting to database...", this);
try
{
con.Open();
}
catch(Exception _e)
{
Debug.LogError("Failed to connect to database(" + _e.GetType().Name + ")!
" + _e.Message, this);
return;
}
Debug.Log("Connected!");
try
{
MySqlCommand cmd = new MySqlCommand("INSERT INTO teilnehmer (EMail, Name) VALUES('" + m_emailInput + "', '" + m_nameInput + "')", con);
cmd.Prepare();
cmd.ExecuteNonQuery();
cmd.Dispose();
}
catch(Exception _e)
{
Debug.LogError("Failed to write subscriber to database(" + _e.GetType().Name + ")!
" + _e.Message, this);
return;
}
Debug.Log(“Successfully wrote subscriber to database!”, this);
con.Close();
con.Dispose();
}
and for Streamwriter:
public void Write(){
using (StreamWriter writer = new StreamWriter (@"Teilnehmer.txt", true)) {
writer.WriteLine (m_nameInput + ": " + m_emailInput);
writer.Flush ();
}
}
Any help is greatly appreciated since i am kinda running out of time