Click here to Skip to main content
15,888,351 members
Home / Discussions / Mobile
   

Mobile

 
GeneralRe: Windows Phone 8 SQLite Question Pin
Pete O'Hanlon12-Apr-13 2:55
mvePete O'Hanlon12-Apr-13 2:55 
GeneralRe: Windows Phone 8 SQLite Question Pin
Tony Palumbo12-Apr-13 3:22
Tony Palumbo12-Apr-13 3:22 
GeneralRe: Windows Phone 8 SQLite Question Pin
Pete O'Hanlon12-Apr-13 3:25
mvePete O'Hanlon12-Apr-13 3:25 
GeneralRe: Windows Phone 8 SQLite Question Pin
Sanjay22Tomar18-Apr-13 0:59
Sanjay22Tomar18-Apr-13 0:59 
QuestionInvoke a secure web service from J2ME Pin
Eng.Fatima M10-Apr-13 22:20
Eng.Fatima M10-Apr-13 22:20 
AnswerRe: Invoke a secure web service from J2ME Pin
Prasad Khandekar30-Apr-13 4:03
professionalPrasad Khandekar30-Apr-13 4:03 
GeneralRe: Invoke a secure web service from J2ME Pin
Eng.Fatima M10-May-13 1:57
Eng.Fatima M10-May-13 1:57 
QuestionWindows Phone 8 SQLite Question Pin
Tony Palumbo10-Apr-13 6:43
Tony Palumbo10-Apr-13 6:43 
I have a Windows Phone 8 App using SQLite (C#, XAML) I want to create records in my table in code. I tried an experiment by just placing a button on my window that executes a counter to create 10 records in my database. When I execute it, I get no errors, but the records are not in the database. Could you tell me what I am doing wrong?


For instance, with my DataModel:

class Test
{
[SQLite.AutoIncrement, SQLite.PrimaryKey]
public int TestID { get; set; }
public int MyCounter { get; set; }
}

And my View Model

public class TestViewModel : ViewModelBase
{
#region Properties

private int testid = 0;
public int testid
{
get
{ return testid; }
set
{
if (testid == value)
{ return; }
testid = value;
RaisePropertyChanged("TestID");
}
}

private int mycounter = 0;
public int MyCounter
{
get
{ return mycounter ; }
set
{
if (mycounter == value)
{ return; }
mycounter = value;
RaisePropertyChanged("MyCounter");
}
}

#endregion


public string SaveRecord(TestViewModel _vm)
{ string result = string.Empty;
using(var db = new SQLite.SQLiteConnection(app.DBPath))
{

string change = string.Empty;
try
{
var er = (db.Table().Where(
c => c.TestID == _vm.TestID)).SingleOrDefault();
if (er != null)
{
er.MyCounter = _vm.MyCounter;
int success = db.Update(er);
}
else
{
int success = db.Insert(new Test()
{
TestID = _vm.TestID,
MyCounter = _vm.MyCounter,
});
}
result = "Success";
}
catch (Exception ex)
{
StringBuilder erMessage = new StringBuilder();
erMessage.Append("This record was not saved.");
erMessage.AppendLine();
erMessage.Append(ex);
result = "This record was not saved.";
}
}
return result;
}

}

So in my Window I just tried a test


public partial class MyWindow : PhoneApplicationPage
{
RoundShotTest mytest = null;
…..
….
}


private void buttonTryMe_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
For(int x = 0; x < 10; x++)
{
mytest = new TestViewModel();
mytest.MyCounter = x;
string result = mytest.SaveRecord(mytest);
}

What am I doing wrong here. I get no error, but when I take a look in the database, the records have not been written?
AnswerRe: Windows Phone 8 SQLite Question Pin
Pete O'Hanlon10-Apr-13 6:49
mvePete O'Hanlon10-Apr-13 6:49 
GeneralRe: Windows Phone 8 SQLite Question Pin
Tony Palumbo10-Apr-13 7:13
Tony Palumbo10-Apr-13 7:13 
QuestionEmergency Pin
kakah100010-Apr-13 1:00
kakah100010-Apr-13 1:00 
AnswerRe: Emergency Pin
Kenneth Haugland10-Apr-13 1:06
mvaKenneth Haugland10-Apr-13 1:06 
GeneralRe: Emergency Pin
David C# Hobbyist.15-Apr-13 12:01
professionalDavid C# Hobbyist.15-Apr-13 12:01 
AnswerRe: Emergency Pin
David C# Hobbyist.10-Apr-13 2:08
professionalDavid C# Hobbyist.10-Apr-13 2:08 
AnswerRe: Emergency Pin
Nier Wong16-Apr-13 22:26
Nier Wong16-Apr-13 22:26 
GeneralCrete a APK file for sencha Pin
Member 76840759-Apr-13 20:55
Member 76840759-Apr-13 20:55 
AnswerRe: Crete a APK file for sencha Pin
Prasad Khandekar30-Apr-13 4:10
professionalPrasad Khandekar30-Apr-13 4:10 
Questionservice to get running application list Pin
prashant_2937-Apr-13 20:04
prashant_2937-Apr-13 20:04 
Questionhow to send gps data via tcp socket from android Client to a .net server and store it in a table of sql server database Pin
haidsai4-Apr-13 12:06
haidsai4-Apr-13 12:06 
AnswerRe: how to send gps data via tcp socket from android Client to a .net server and store it in a table of sql server database Pin
Prasad Khandekar30-Apr-13 4:33
professionalPrasad Khandekar30-Apr-13 4:33 
AnswerSolved! Convert apk to jar Pin
jojoba201130-Mar-13 4:21
jojoba201130-Mar-13 4:21 
AnswerRe: Convert apk to jar Pin
Thomas Daniels30-Mar-13 4:47
mentorThomas Daniels30-Mar-13 4:47 
QuestionRe: Convert apk to jar Pin
jojoba201130-Mar-13 10:48
jojoba201130-Mar-13 10:48 
AnswerRe: Convert apk to jar Pin
Thomas Daniels30-Mar-13 22:52
mentorThomas Daniels30-Mar-13 22:52 
QuestionRe: Convert apk to jar Pin
jojoba201131-Mar-13 7:40
jojoba201131-Mar-13 7:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.