/// <summary>
        /// 获取TopicModel
        /// </summary>
        /// <param name="topicGuid">topicGuid</param>
        /// <returns></returns>
        private TopicModel GetTopicModel(string topicGuid)
        {
            string            sqlstring  = "select * from t_utility_topic where topic_guid=@topic_guid";
            DynamicParameters parameters = new DynamicParameters();

            parameters.Add("topic_guid", topicGuid, System.Data.DbType.String);
            using (MySql.Data.MySqlClient.MySqlConnection conn = MySqlHelper.GetConnection())
            {
                return(conn.QueryFirst <TopicModel>(sqlstring, parameters));
            }
        }
Esempio n. 2
0
        public void Test()
        {
            string connString = "";

            using (var conn = new MySql.Data.MySqlClient.MySqlConnection("server=192.168.255.128;User Id=root;password=root;Database=testdb"))
            {
                conn.Open();
                string sql   = "select count(1) from tb_user";
                int    count = conn.QueryFirst <int>(sql);
            }
            Console.WriteLine("Hello World!");
        }