mCleaner.Logics.Commands.CommandLogic_Chrome.GetIDsFromURLs C# (CSharp) Method

GetIDsFromURLs() static private method

static private GetIDsFromURLs ( string file, string url ) : int
file string
url string
return int
        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;
        }