Hello guys ! I am currently programming an app for Android (which later will be also programmed to iOS) and I am confused. I program in C# and ASP for like 3 years now and I can program a web application pretty easily, using web services and an Access database to store the information. I've downloaded Xamarin and I am trying to develop an app, the problem is, I have no idea how the hell does this thing works. Since Access uses a pretty amateur DB I've decided to move on to MySQL for the first time though this is kinda irrelevant as I need to solve other things before getting down to this. I've seen that using web services isn't that simple as using them in a web app so I figured I'll just do a static class that will do all of those actions and to activate those functions in an activity (I don't know if it's the right place to activate them though). For say I have a "Login with Facebook", and I managed to make it work and I can login with Facebook now and can retrieve the information, though I have zero idea on how to store it to a MySQL database. I have a simple class that does the ADO functions such as "Execute Non Query" :
class DoQueries
{
public static SqliteConnection cnn;
public static SqliteConnection Connection()
{
var documents = System.Environment.GetFolderPath(
System.Environment.SpecialFolder.Personal);
string db = Path.Combine(documents, "HookAppsDB.mwb");
bool exists = File.Exists(db);
if (!exists)
SqliteConnection.CreateFile(db);
var cnn = new SqliteConnection("Data Source=" + db);
return cnn;
}
public static bool ExecuteNonQuery(string strSQL)
{
cnn = Connection();
var cmd = strSQL;
bool r = false;
cnn.Open();
using (var c = cnn.CreateCommand())
{
c.CommandText = cmd;
c.CommandType = CommandType.Text;
r = (c.ExecuteNonQuery() != 0);
}
cnn.Close();
return r;
}
And then in a different static class I have the function that adds the user to the database :
public static void AddUpdateUser(User userDetails, int flag)
{
strsql = string.Format("insert into tblUsers (UserEmail, Username, FirstName, LastName, Gender, Birthday, ProfileURL, Status, FacebookID) values ('{0}', '{1}', '{2}', '{3}', {4}, {5}, '{6}', {7}, '{8}')", userDetails.Email, userDetails.UserName, userDetails.FName, userDetails.LName, userDetails.Gender, userDetails.Birthday, userDetails.ProfileURL, userDetails.UStatus, userDetails.FacebookID);
DoQueries.ExecuteNonQuery(strsql);
}
I'm getting all of that data from the Facebook sdk.
I am 100% I'm not doing something right as it seems hella wrong, I just don't know what and where to progress to.
Creating a local db seems wrong since I'm expecting a big traffic on the app (I at least hope so) and how to export it to a MySQL database is all new to me.
Thanks !
P.s also opened it in General forum since I don't know where it really belongs to.