I am developing an application for Windows Phone 7. I am new to Windows Phone 7. I am new to Application.GetResourceStream (). I am using the following link in my application.
http://wirebear.com/blog/2010/11/12/using-sqlite-in-your-wp7-app
I follow the steps described in the link above. I am facing a problem in the Application.GetResourceStream () method. In the above method, I use the following code
Stream src = Application.GetResourceStream(
new Uri(@"/SQLiteConnectivity;component/" + dbName,
UriKind.Relative)).Stream;
I right-clicked my project name and selected properties and found the assembly name as "SQLiteConnectivity". After starting the application, I get a null reference exception error in Application.GetResourceStream (). I also do not know what should be used instead of the "component" in the Application.GetResourceStream () method. Can you provide me with any code or link or any solution through which I can solve the above problem?
Yes, I received the answer as described in the answer section. I solved the above problem by setting the “Build Action” in my database properties as “Resource” and “Copy to output directory” as “Always copy.” But now I am faced with a new problem.
I wrote the following code in my app.xaml.cs application
public partial class App : Application
{
public PhoneApplicationFrame RootFrame { get; private set; }
private DBHelper _db;
public DBHelper db
{
get
{
if (_db == null)
_db = new DBHelper("ExpenseManager.db");
return _db;
}
}
}
.xaml.cs
private void button1_Click(object sender, RoutedEventArgs e)
{
_customerEntries = (Application.Current as App).db.SelectObservableCollection<Category>("SELECT Category_Name FROM Category WHERE Category_ID=1");
textBox1.Text = _customerEntries.ToString();
}
mainpage
public class Category
{
public int Category_ID { get; set; }
public string Category_Name { get; set; }
}
, , , " " SQLClient.cs BindAll (ppStmt);
Sqlite3.Vdbe Prepare()
{
Sqlite3.Vdbe ppStmt=new Sqlite3.Vdbe();
if (Sqlite3.sqlite3_prepare_v2(_db, CommandText, CommandText.Length, ref ppStmt, 0) != Sqlite3.SQLITE_OK)
throw new SQLiteException(Sqlite3.sqlite3_errmsg(_db));
BindAll(ppStmt);
return ppStmt;
}
- , ? - , , , .