static int GetIDsFromURLs(string file, string url)
{
int ret = 0;
string sqlitefile = "Data Source=" + file;
using (SQLiteConnection conn = new SQLiteConnection(sqlitefile))
{
conn.Open();
SQLiteCommand comm = conn.CreateCommand();
comm.CommandText = string.Format("select id from urls where url='{0}'", url);
comm.CommandType = CommandType.Text;
try
{
SQLiteDataReader reader = comm.ExecuteReader();
if (reader.HasRows)
{
reader.Read();
ret = reader.GetInt32(reader.GetOrdinal("id"));
}
}
catch (Exception ex)
{
ret = 0;
}
conn.Close();
}
return ret;
}