1

I am new to c#, how do I read local database file in C# WPF?

I have tried this tutorial: Link.

But I can`t manage get it to work, where do I put .db file, can some one point me to good tutorial or show the right direction.

RajeshKdev
  • 6,365
  • 6
  • 58
  • 80
Dim
  • 4,527
  • 15
  • 80
  • 139
  • you might find this helpful http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/92af8085-e9e7-411b-9ab0-52ae0e62942c/ – Rachel Gallen Apr 17 '13 at 12:34
  • you might also want to look at this question http://stackoverflow.com/questions/2869192/wpf-embedded-database-application – Rachel Gallen Apr 17 '13 at 12:37
  • You can learn through this question [Click Here](http://stackoverflow.com/questions/1345508/how-do-i-connect-to-a-sql-database-from-c) – RajeshKdev Apr 17 '13 at 12:37
  • and this http://stackoverflow.com/questions/6419164/how-can-i-bind-a-c-net-dataview-wpf-to-a-sqlite-database – Rachel Gallen Apr 17 '13 at 12:38

1 Answers1

1

try this;

string dbfile = "C:\\.....\\datasabename.db";
string connStr= "Data Source=" + dbfile  + ";Version=3;Synchronous=Off;UTF8Encoding=True;";

SQLiteConnection sqlConn= null;
sqlConn = new SQLiteConnection(connStr);
sqlConn.Open();
Mehmet Ince
  • 4,059
  • 12
  • 45
  • 65