i’m using vs2008 and SQLLite.Net,
when i using these code:
String sel = "select * from admins where [name]='admin88' and [password]='123456'";
System.Data.SQLite.SQLiteConnection conn = new System.Data.SQLite.SQLiteConnection();
conn.ConnectionString = Config.connStr;
conn.Open();
System.Data.SQLite.SQLiteCommand cmd = new System.Data.SQLite.SQLiteCommand();
cmd.CommandText = sel;
cmd.CommandType = CommandType.Text;
cmd.Connection = conn;
DataSet set = new DataSet();
System.Data.SQLite.SQLiteDataAdapter adp = new System.Data.SQLite.SQLiteDataAdapter() ;
adp.SelectCommand = cmd;
adp.Fill(set);
adp.Dispose();
Response.Write(set.Tables.count);
it works.
but when i using parameters ,return null:
String sel = "select * from admins where [name]=@name and [password]=@pass";
cmd.Parameters.Clear();
cmd.Parameters.Add(new System.Data.SQLite.SQLiteParameter("@name", "admin88"));
cmd.Parameters.Add(new System.Data.SQLite.SQLiteParameter("@pass", "123456"));
Ref: SQL As Understood By SQLite
Your query should be as:
Add parameters without @ symbol. Check the following code snippet.
Reference this.