lundi 6 avril 2015

SQLite local database in unity 3D

I am a new programmer for unity 3D v4.5 pro.I am using unity 3D for my augmented reality application and i have chosen SQLite to create and easily handle with my database (after building it on android). I Found 2 scripts here in java http://ift.tt/1aCMkF5 ...I converted it to c#(because i am programming with c#)and it helped me alot but i just couldn't find a method "query" to delete for example only firstName or LastName ..I tried like that :



public void DeleteFrom ( String tableName,String itemToDelete, String wPar,String wValue )
{
string query ;
query = "DELETE FROM " + tableName + " WHERE " + itemToDelete + wPar + wValue ;
dbcmd = dbcon.CreateCommand();
dbcmd.CommandText = query;
reader = dbcmd.ExecuteReader();
}


then i call it in the other script "usethe database" as it is bellow



public void DeleteRow(string FirstName )
{
db.DeleteFrom("'"+TableName+"'","FirstName","=","'"+firstName+"'");
}


But what i get is deleting the whole Row ( firstName lastName)


I don't know if you have understand what i mean: i just want to delete firstName and keep in my datatable it's assignment which is lastName so i can assign for that lastName later any other new firstName. I hope you understant my point .Please, i'll appreciate any help and thank you in advance. :)


Aucun commentaire:

Enregistrer un commentaire