string connString = ConfigurationManager.AppSettings["SqlConn"].ToString(); var conn=new SqlConnection(connString); //var cmd = new SqlCommand("SELECT alliance,ballid FROM talliance with(nolock) WHERE type=8 AND alliance like ‘%‘+@alliance;"); var cmd = new SqlCommand("SELECT alliance,ballid FROM talliance WHERE type=8 AND alliance like ‘‘+ @alliance +‘%‘;"); cmd.Parameters.Add(new SqlParameter("@alliance", SqlDbType.NVarChar, 1000)); //cmd.Parameters[0].Value = "||ATP Sydney international match"; cmd.Parameters[0].Value = "ATP 悉尼國際賽||"; cmd.Connection = conn; conn.Open(); var dr = cmd.ExecuteReader(); while (dr.Read()) { Console.WriteLine("alliance:"+dr[0].ToString() +"---"+"ballid:"+dr[1].ToString()); } dr.Dispose(); conn.Close(); Console.ReadKey();