I am trying to creating windows phone 8 project with database (sqlite) techniques
I have tried the following:
1) Download sqlite fie from server & saved it
i got it., according to "Jan Smuda " reply i found solution for that .,
i removed the binding syntax (ItemsSource="{Binding}") in XAML code for both listpicker and listbox and add itemsSource in code itself., like this
so my XAML code like this:
and my CS code like this :
string country = "Full Schedule";
List ScheduleList;
// the local folder DB path
string DB_PATH = Path.Combine(ApplicationData.Current.LocalFolder.Path, "sample.sqlite");
//SQLite connection
private SQLiteConnection dbConn;
ProgressIndicator _progressIndicator = new ProgressIndicator();
private List _source = new List
{
"Full Schedule","Afghanistan","Australia","Bangladesh","England","Hong Kong","India","Ireland","Nepal","Netherlands","New Zealand","Pakistan","South Africa","Sri Lanka","UAE","West Indies","Zimbabwe"
};
public Schedule()
{
InitializeComponent();
selectTeam.ItemsSource = _source;
Loaded += Schedule_Loaded;
}
void Schedule_Loaded(object sender, RoutedEventArgs e)
{
}
private void selectTeam_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
country = (sender as ListPicker).SelectedItem.ToString();
dbConn = new SQLiteConnection(DB_PATH);
/// Create the table Task, if it doesn't exist.
dbConn.CreateTable();
if (country == "Full Schedule")
{
ScheduleList = dbConn.Query("select * from tableName").ToList();
}
else
{
ScheduleList = dbConn.Query("select * from tableName where team1_Name=? or team2_Name=?", country).ToList();
}
scheduleListbox.ItemsSource = ScheduleList;
}
}
public class match_schedule
{
[PrimaryKey, AutoIncrement]
public int match_id { get; set; }
public string team1_Name { get; set; }
public string team2_Name { get; set; }
public string match_no { get; set; }
public string group { get; set; }
public string venue { get; set; }
public string time { get; set; }
public string day { get; set; }
}
Finally I Got to retrieve column values from my local SQLite Database and i bind it in listbox.,
Lot of thanks to jan Smuda for responding me and thanks to stack overflow also.,